[Users] Modify record in a store

Matt Priour mpriour at kestrelcomputer.com
Thu Oct 1 03:50:10 CEST 2009


You've got a whole lot of things going wrong there.
You should really look into the ExtJS docs regarding DataStores.
http://www.extjs.com/deploy/ext-2.2/docs/?class=Ext.data.JsonStore

id is a property of the store, not the field. id refers to the field whose value will be used as the record's id and used in functions like getById.
the function record.set modifies the value found in the field indicated in the first parameter and changes it to the value indicated in the second parameter.
Your use of it fails because you don't have a field named "name" .
If you did it would change the value in that field in the record to the string "id"

Hope that helps at least point you in the right direction to begin accomplishing what you are wanting to do.

Matt Priour
Kestrel Computer Consulting


From: James McManus 
Sent: Wednesday, September 30, 2009 6:08 PM
To: users at geoext.org 
Subject: [Users] Modify record in a store


Hi - I would like to modify a record in a store, I created using GeoExt.data.FeatureStore. The actual store looks like:

        var store = new GeoExt.data.FeatureStore({
          fields: [
             {id: new Date().getTime(), name: 'stfid', type: 'string'},
             {id: new Date().getTime(), name: 'ch_0209_r_tax_val', type: 'float'}
          ]
        });

I thought I could modify it by doing the following:

var record = store.getAt(0);
record.set("name", "id");

which would change stfid to id. But that did not work. I think it is because I'm not dealing with the presents of "fields".  I've tried a variety of things without success.  Is there a simple way of doing this?

Thanks
Jim




--------------------------------------------------------------------------------


_______________________________________________
Users mailing list
Users at geoext.org
http://www.geoext.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20090930/796b36da/attachment.htm 


More information about the Users mailing list