1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    1
    Vote Rating
    0
    maroof.saeed is on a distinguished road

      0  

    Default list didnt render on 2nd time while using listpaging

    list didnt render on 2nd time while using listpaging


    Hi
    I have a application in sencha 1.1 that on start up shows list like login, register, view dispensaries etc. when i click on view dispensaries the store loads and pulls json data from server that is fine, now when i click on Load More button using list paging plugin it loads next 10 records that is also ok. Now problem is this that if i go back to home view or some other view and then again go back to View dispensaries the store actually loads but didnt render the list, even if you wait for 10 mins but if i change my device orientation to landscape the list appears and shows the normal behavior. So my point is whats i am doing wrong that after using list paging and then again loading the list store the list didn't appear until i change my device orientation. Here is my code. Note if i didnt use listpaging plugin the list works fine on every call but the problem starts when i clicked 2 to 3 times on load more. Here is my code.

    Code:
    Ext.regModel('DispensaryList', {
             fields: [
                {name: 'id', type: 'int'},
                {name: 'name', type: 'string'},
                {name: 'address', type: 'string'},
             ]
        });
    
     var Dispdata = new Ext.data.Store({
            model  : 'DispensaryList',
            storeId: 'dispensary_store',
            clearOnPageLoad: false, 
           proxy: {
                type: 'ajax',
                id: 'disp_data_url',
                url: 'http://www.abc.com/abc.cfm',
                reader: {
                    type: 'json',
                    root: 'results',
                    totalProperty: 'total'
                }
            },
            getGroupString : function(record) {
                if (record && record.data.name_full) {
                    return record.get('name_full');
                } else if(record && record.data.medname){
                    return record.get('medname');
                } 
                else {
                    return '';
                }
            },
            listeners: {
                'load': function (t, r, s) {
                    Ext.dispatch({
                        controller: abc.controllers.desplist,
                        action: 'loaded',
                        records: r
                    });
                },
                'beforeload': function (store, option){
                    Ext.dispatch({
                        controller: abc.controllers.desplist,
                        action: 'beforeloaded',
                        records: option
                    });
                }
            },
            autoLoad:false,
            pageSize: 10
        });
    
    abc.views.despList = new Ext.List({
            id: 'despList',
            layout: 'fit',
            fullscreen: true,
            emptyText: '<p class="no-searches">No record found.</p>',
            cls: 'bg_list',
            grouped: true,
            frame:true,
            itemTpl : '<div class="disp_list_img">{name_full}</div>',
            store: Dispdata,
            singleSelect : true,
            disableSelection: true,
            //itemSelector : 'span.id',
            plugins: [
                {
                    ptype: 'pullrefresh',
                    refreshFn: function(callback, plugin) {
                        console.log( 'me1' );
                       Dispdata.load(function(records, operation, success) {
                            callback.call(plugin);
                            console.log( 'me3' );
                        });
                    }
                },
                {
                    ptype: 'listpaging',
                    autoPaging: false,
                    onPagingTap : function(e) {
                        if (!this.loading) {
                            this.loading = true;
                              this.el.addCls('x-loading');
                            this.list.store.nextPage();
                        }
                    }
                }
            ],
            onItemDisclosure: function (list, index, itm, event) {
                
            },
            listeners:{
                itemtap: function(list, index, itm, event){
                    var view_val = Ext.getCmp("disp_top_title").disp_view_val;
                    getDispDetail(list, index, itm, event, view_val);
                }
            }
        });
    
    abc.views.DispListContainer = new Ext.Panel({
            id: 'DispListContainer',
            layout: 'fit',
            dockedItems: [abc.views.DispTopToolbar,abc.views.DispMiddleToolbar,abc.views.DispBottomToolbar],
            items: [abc.views.despList]
        });
    On Clicking view dispensaries here is the code

    Code:
    Ext.getStore("dispensary_store").proxy.url =  dynamic url;
    Ext.getCmp("disp_top_title").removeCls('disp_title1');
    Ext.getCmp("disp_top_title").removeCls('disp_title2');
    Ext.getCmp("disp_top_title").addCls('disp_title');
    Ext.getCmp("disp_top_title").update('Dispensary');
    Ext.getCmp("disp_top_title").disp_view_val = 'Dispensary';
    Ext.getStore("dispensary_store").load();
    abc.views.viewport.setActiveItem('DispListContainer', {type: 'slide', direction: 'left'});
    Last edited by mitchellsimoens; 9 Apr 2012 at 6:21 AM. Reason: added [CODE] tags

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    There isn't anything here that shouts that it is breaking things.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

Thread Participants: 1

Tags for this Thread