1. #1
    Ext User
    Join Date
    Mar 2007
    Posts
    7
    Vote Rating
    0
    xsokev is on a distinguished road

      0  

    Default Possible bug in Ext.View

    Possible bug in Ext.View


    I used the following code to create a View that I could update with JSON data.

    Code:
    var Root = Ext.data.Record.create([
    		{name: 'refId', mapping: 'refId'},
    		{name: 'displayType', mapping: 'displayType'},
    		{name: 'systemName', mapping: 'systemName'},
    		{name: 'title', mapping: 'title'},
    		{name: 'parentKeyName', mapping: 'parentKeyName'},
    		{name: 'urlArgs', mapping: 'urlArgs'},
    		{name: 'cls', mapping: 'cls'}
    ]);
    var sectionReader = new Ext.data.JsonReader({
    	root: 'root',
    	id: 'refId'
    }, Root); 
    var sectionDS = new Ext.data.Store({
    	proxy: new Ext.data.MemoryProxy(),
    	reader: sectionReader
    });
    var tplSection = new Ext.Template( '<div class="{cls}" id="{refId}" name="{systemName}" type="{displayType}" display="{title}" title=">>Load {title} Menu" key="{parentKeyName}" args="{urlArgs}">{title}</div>' );
    tplSection.compile();
    // initialize the Section View
    var sectionView = new Ext.View('myview', tplSection, 
      { 
    	store: sectionDS, 
    	singleSelect: true, 
    	selectedClass: 'list-row-selected', 
    	emptyText: 'Unable to load menu roots' 
      });
    I was trying to update a Ext.View by manually reading JSON records into the view's store and refreshing the view using the following code.

    Code:
    var records = sectionView.store.reader.readRecords({'root': someJSONData});
    sectionView.store.loadRecords(records, {add: true}, true);
    sectionView.refresh();
    The code would execute but the view was never refreshed. After digging into the debug code, I found that the following existed at line 9079:

    Code:
        refresh : function(){
            var t = this.tpl;
            this.clearSelections();
            this.el.update("");
            var html = [];
            var records = this.store.getRange();
            if(records.length < 1){
                this.el.update(this.emptyText);
                return;
            }
            for(var i = 0, len = records.length; i < len; i++){
                var data = this.prepareData(records[i].data, i, r);
                html[html.length] = tpl.apply(data);
            }
            this.el.update(html.join(""));
            this.nodes = this.el.dom.childNodes;
            this.updateIndexes(0);
        },
    this.prepareData uses an argument r that doesn't appear to exist.

    tpl.apply(data) should either be this.tpl.apply(data) or t.apply(data)

    After making those changes, the view refreshed as expected.

  2. #2
    Sencha User jack.slocum's Avatar
    Join Date
    Mar 2007
    Location
    Tampa, FL
    Posts
    6,955
    Vote Rating
    17
    jack.slocum will become famous soon enough jack.slocum will become famous soon enough

      0  

    Default


    Thank you. I have made those changes.

    Btw, the store API does have some functions other than loadRecords (add, insert) that may be more appropriate. loadRecords may be a private function for the release.

Similar Threads

  1. ext.View and ext.JSONView
    By jon.whitcraft in forum Community Discussion
    Replies: 18
    Last Post: 19 Feb 2009, 1:58 AM
  2. Any simple example with Ext.view
    By galdaka in forum Ext 2.x: Help & Discussion
    Replies: 0
    Last Post: 30 Mar 2007, 6:43 AM
  3. View and JsonView UML
    By BernardChhun in forum Community Discussion
    Replies: 3
    Last Post: 10 Feb 2007, 9:13 AM
  4. Advice using View
    By ncubeait in forum Ext 1.x: Help & Discussion
    Replies: 10
    Last Post: 9 Feb 2007, 4:35 AM
  5. View question...
    By zquirm in forum Ext 1.x: Help & Discussion
    Replies: 2
    Last Post: 16 Dec 2006, 7:01 PM

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi