Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Alloy throwing an 'assertion error' when rendering ListView

$
0
0

Application type: iOS Titanium SDK: 3.4.0.GA Platform & version: iOS 8.0.2 Device: iPhone 5s Host Operating System: OSX 10.9.5 Titanium Studio: 3.4.0.201409261227

Console Output:

[DEBUG] *** Assertion failure in -[UITableView _endCellAnimationsWithContext:], /SourceCache/UIKit/UIKit-3318.0.1/UITableView.m:1582
This is being thrown after I click on the TableViewRow:

clientDetail.xml

<Alloy> 
    <Window backgroundColor="white" title="Detail">
        <TableView class="detailTable">
            <TableViewSection>
                <TableViewRow title="Appointment" hasChild="true" onClick="openApptWin"></TableViewRow>
            </TableViewSection>
        </TableView>
    </Window>
</Alloy>
clientDetail.js
var args = arguments[0] || {};
 
$.tab1 = args.parentTab;
 
function openApptWin() {
    var apptController = Alloy.createController('appointment', {parentTab : $.tab1});
    $.tab1.open(apptController.getView());
}
it throws the error after rendering only 2-3 rows of the ListView that is simply displaying 8 weeks of dates that are bound to a collection:

appointment.xml

<Alloy>
    <Collection src="weeks" />
    <Window backgroundColor="white" title="Appointment">
        <ListView id="list" top="0" defaultItemTemplate="calendarWeeks" separatorColor ="transparent" >
            <Templates>
                <ItemTemplate name="calendarWeeks">
                    <Label bindId="sunday" height ="TI.UI.SIZE" left="10" color="black" onClick="getEvents" />
                    <Label bindId="monday" height ="TI.UI.SIZE" left="50" color="black" onClick="getEvents" />
                    <Label bindId="tuesday" height ="TI.UI.SIZE" left="100" color="black" onClick="getEvents" />
                    <Label bindId="wednesday" height ="TI.UI.SIZE" left="150" color="black" onClick="getEvents" />
                    <Label bindId="thursday" height ="TI.UI.SIZE" left="200" color="black" onClick="getEvents" />
                    <Label bindId="friday" height ="TI.UI.SIZE" left="250" color="black" onClick="getEvents" />
                    <Label bindId="saturday" height ="TI.UI.SIZE" left="300" color="black" onClick="getEvents" />
                </ItemTemplate>
            </Templates>
            <ListSection id="section" dataCollection="weeks">
                <ListItem name="{calendarWeeks}" sunday:text="{sunday}" monday:text="{monday}" tuesday:text="{tuesday}" wednesday:text="{wednesday}" thursday:text="{thursday}" friday:text="{friday}" saturday:text="{saturday}"/>
            </ListSection>
        </ListView>
    </Window>
</Alloy>
appointment.js
var args = arguments[0] || {};
 
$.tab1 = args.parentTab;
 
// Load moment library
var moment = require('alloy/moment');
 
var weeks = Alloy.Collections.weeks;
weeks.reset();
 
// Execute function upon view open event
$.appointment.addEventListener("open", function() {
 
    // set current time
    var now = moment();
 
    // this sets date to beginning of the week of the current day
    var date = now.startOf('week');
 
    // generate 8 weeks worth of dates starting at beginning of week
    function makeDates(date) {
        dates = [date.date()];
        for ( i = 0; i <= 54; i++ ) {
            var addDate = date.add('days', 1);
            var dateAdded = addDate.date();
            dates.push(dateAdded);
        }
        return dates;
    }
 
    // Store by week into Collection
    function makeWeeks(dates){
        for ( i=0; i < dates.length; ){
            var week = Alloy.createModel('weeks');
            week.set('sunday', dates[i++]);
            week.set('monday', dates[i++]);
            week.set('tuesday', dates[i++]);
            week.set('wednesday', dates[i++]);
            week.set('thursday', dates[i++]);
            week.set('friday', dates[i++]);
            week.set('saturday', dates[i++]);
            weeks.add(week);
            Ti.API.info(weeks);
        }
    }
 
    makeWeeks(makeDates(date));
 
});
 
function getEvents (e){
    Ti.API.info("I clicked to get events");
    var section = $.list.sections[e.sectionIndex];
    var item = section.getItemAt(e.itemIndex);
    var detailController = Alloy.createController('appointmentDetail', {
        parentTab : $.tab1,
        data: item
    });
    $.tab1.open(detailController.getView());
}
weeks.js
exports.definition = {
    config: {
        columns: {
            "sunday": "text",
            "monday": "text",
            "tuesday": "text",
            "wednesday": "text",
            "thursday": "text",
            "friday": "text",
            "saturday": "text"
        },
        adapter: {
            type: "sql",
            collection_name: "weeks"
        }
    },
    extendModel: function(Model) {
        _.extend(Model.prototype, {
            // extended functions and properties go here
        });
 
        return Model;
    },
    extendCollection: function(Collection) {
        _.extend(Collection.prototype, {
            // extended functions and properties go here
        });
 
        return Collection;
    }
};
This was working before I upgraded to Alloy 1.5.1 (as well as the SDK version/iOS version listed above), so any help in identifying if this is something that I am doing or if I need to put in a support ticket would be greatly appreciated.

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>