PDA

View Full Version : [solved] always send all rows from store to server?



bikram
20 Oct 2010, 9:32 AM
Hello,

Just a noob question :">

I have a store that uses a httpproxy, jsonreader and jsonwriter.
I was wondering if its possible for the store to send back all records (changed as well as unchanged), during a save.
Is there something in the config for the store/writer where i could do this, or is there other programmatic ways of doing this, by looping thru the records and doing a store.getAt(i).reject(), for instance?

thanks very much,
bikram

troseberry
20 Oct 2010, 9:39 AM
in your writer set


writeAllFields: true

hope that helps

bikram
20 Oct 2010, 9:47 AM
in your writer set


writeAllFields: true

hope that helps
this is already in place in the writer.
what this does is to ensure that all fields within a given record are always sent.
what i am trying to do is to ensure that all of my records , in the store, are always sent back to the server. the default action of the store is to send back only the records that have been changed, and i need a way to send back all records, everytime (changed or not).

sorry, if i wasn't very clear in the original question.

plalx
20 Oct 2010, 10:11 AM
I think you will have to roll your own solution. I would use Ext.util.JSON.encode to build a JSON string looping over all store records. And then send the resulting JSON string to the server using Ext.Ajax.request.

bikram
20 Oct 2010, 1:22 PM
I think you will have to roll your own solution. I would use Ext.util.JSON.encode to build a JSON string looping over all store records. And then send the resulting JSON string to the server using Ext.Ajax.request.
ok.
short of that, is there any way to programatically mark a record as 'changed', so that the save will pick it up?

plalx
20 Oct 2010, 3:16 PM
You can try setting the dirty property of Ext.data.Record to true.

bikram
20 Oct 2010, 3:38 PM
so, in my completely noob approach, this is what i did-
in the store's save event listener, just updated all the records by appending one of the fields with a single space. that did the trick. this marked the rows as newly changed.
there is a minor issue of now that field getting tagged with a red triangle, but that i can fix later. In addition , i suspect that i could conceivably similarly update a field that is hidden in my column model, and still get the record returned as 'changed'.

the dirty property of record is read-only, so can't do anything there.
the MarkDirty() method only applies to phantom records, which is not the case here.

Hopefully the extJs team will consider providing a config option that does all this for us, either at the store or at the editablegrid level.