1. #11
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default


    I've modified DataReader#realize, DataReader#update to accept Array from server when saving/creating single records.

    committed to SVN.

    Code:
    // If rs is NOT an array but data IS, see if data contains just 1 record.  If so extract it and carry on.
    if (Ext.isArray(data) && data.length == 1) {
        data = data.shift();
    }
    /**
    * @author Chris Scott
    * @business www.transistorsoft.com
    * @rate $150USD / hr; training $500USD / day / developer (5 dev min)
    *
    * @SenchaDevs http://senchadevs.com/developers/transistor-software
    * @twitter http://twitter.com/#!/christocracy
    * @github https://github.com/christocracy
    */

  2. #12
    Ext User
    Join Date
    Jun 2008
    Location
    Dover, NH
    Posts
    10
    Vote Rating
    0
    iwtlf is on a distinguished road

      0  

    Default


    Nice. Thanks.

    I have another problem though... I already have 2 objects in the store and then add a new one with the code I detailed in that post (with all the corrections).

    Here's what I get in firebug though:
    Code:
    >>> App.usersStore.getAt(0)
    Object id=somekey1
    >>> App.usersStore.getAt(1)
    Object id=somekey2
    >>> App.usersStore.getAt(2)
    Object phantom=false
    Now the third record does have an id (set automatically to the server's pk). Somehow it is treated differently from the other records. It doesn't seem to affect it in any way except that its selection/deselection in a grid based on that store doesn't work well.

    Basically once selected, I can select another record but the third one will not visually be deselecedt unless I Ctrl-click it.

    If I destroy the grid and recreate it then the problem will go away and the output in firebug becomes the expected:
    Code:
    >>> App.usersStore.getAt(0)
    Object id= somekey1
    >>> App.usersStore.getAt(1)
    Object id= somekey2
    >>> App.usersStore.getAt(2)
    Object id= somekey3
    Here's the code for the grid:
    Code:
    var selM = new Ext.grid.RowSelectionModel({
    	singleSelect:true,
    	listeners:{
    		selectionchange: function(sm){
    			if(sm.getCount()==1&&sm.getSelected().id!=App.user.id){
    				// something
    			} else{
    				// something
    			}
    		}
    	}
    });
    var grid = new Ext.grid.GridPanel({
    	stateId:'app_g_users',
    	store:usersStore,
    	border:true,
    	loadMask:true,
    	stripeRows:true,
    	viewConfig:{forceFit:true},
    	selModel:selM,
    	cm:new Ext.grid.ColumnModel([
    		{header: "Nickname", width: 100, sortable: true, dataIndex: 'nickname'}
    	]),
    	listeners:{
    		rowdblclick: function(){
    			// do something
    		}
    	}]
    });
    Note: the problem only occurs after I have called the save method on the store and it sets the id based on the returned PK. There is no issue with a newly added record per se.

    For instance, this code alone will be fine:
    Code:
    var nRec = new userRecord({
    	nickname: "Test"
    });
    usersStore.addSorted(nRec);
    The selections will work as expected until I call the store's save() function and it updates the added record with the server's PK.

  3. #13
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default


    Roger, I'm on it.
    /**
    * @author Chris Scott
    * @business www.transistorsoft.com
    * @rate $150USD / hr; training $500USD / day / developer (5 dev min)
    *
    * @SenchaDevs http://senchadevs.com/developers/transistor-software
    * @twitter http://twitter.com/#!/christocracy
    * @github https://github.com/christocracy
    */

  4. #14
    Ext User
    Join Date
    Jun 2008
    Location
    Dover, NH
    Posts
    10
    Vote Rating
    0
    iwtlf is on a distinguished road

      0  

    Default


    Also, doing the following does not return anything for a newly created record even though the key has been set and can be accessed with the id property of the record (all other records are returned just fine):
    Code:
    usersStore.getById('newPKasReturnedByServer')
    Only way to make it work is to reload the store.

  5. #15
    Ext User
    Join Date
    Jun 2008
    Location
    Dover, NH
    Posts
    10
    Vote Rating
    0
    iwtlf is on a distinguished road

      0  

    Default


    Still broken as of RC1.1 (I made the necessary changes to the code to reflect the revamped CRUD functions - the record has its ID set just fine).

    Note: to go around it, I use the following (temporarily hopefully):
    Code:
    usersStore.getAt(usersStore.find('key','newPKasReturnedByServer'))

  6. #16
    Ext JS Premium Member christocracy's Avatar
    Join Date
    Oct 2006
    Location
    Montreal
    Posts
    381
    Vote Rating
    0
    christocracy is on a distinguished road

      0  

    Default


    Ok, she's good-to-go in SVN. Newly realized records are now re-mapped in Store's underlying MixedCollection. Big thanks to Mr LeCompte for keeping me informed and delivering to me the solution code on a platter prepared by Mr Condor.
    /**
    * @author Chris Scott
    * @business www.transistorsoft.com
    * @rate $150USD / hr; training $500USD / day / developer (5 dev min)
    *
    * @SenchaDevs http://senchadevs.com/developers/transistor-software
    * @twitter http://twitter.com/#!/christocracy
    * @github https://github.com/christocracy
    */

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..."