Opened 5 years ago

Closed 5 years ago

#17616 closed defect (invalid)

dgrid memory datastore not saving values

Reported by: Shay Lavi Owned by: Shay Lavi
Priority: undecided Milestone: tbd
Component: General Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by ben hockey)

I've created a dgrid and mapped him data out of 3 columns as a query result of a FeatureLayer?.

The columns were binded with Memory as a datastore.

the last column I mapped was empty as I want to insert an Editor there for the user to type in data.

When the user typed in, the data was not stored in the correct Memory datastore location.. Instead of storing the value in the right location, the value was ADDED as a new Memory datastore value.

After 3-4 full days of tests and frustrations, I discovered that if the columns does not have a column named "id", that's what causing this weird behavior.

here is the example -

http://developers.arcgis.com/en/javascript/sandbox/sandbox.html?sample=fl_dgrid

CHANGE line 37 - FROM "dojo/ready", TO "dojo/ready", "dgrid/editor",

CHANGE line 56 - FROM ready, TO ready, editor,

CHANGE line 85 - TO "over1m": editor({label:"test",autoSave:true},"text")

copy paste all the source code on the left side into a new HTML file and run it.

now insert some text on square 2 and 4

examine with a debugger the following item - window.grid.store.data

you will see there the text you entered in the correct id values

that's good!

now change line 82 - FROM "id" : "ID", TO "idnumber" : "ID",

change line 140 - FROM "id" : .......... TO "idnumber" : .........

repeat the above test - once you'll examine the store data, you'll find that instead of saving the values in the correct array items, the store now has 1 additional memory value and the text was saved in the last 2 values of the array

OMG!!! the amount time I've spent on this thing!!!

Change History (3)

comment:1 Changed 5 years ago by ben hockey

Description: modified (diff)
Owner: set to Shay Lavi
Status: newpending

your problem is that you need to change the idProperty of the store. does it all work if you also change line 146 to

var memStore = new Memory({ data: data, idProperty: 'idnumber' });

comment:2 Changed 5 years ago by Shay Lavi

Status: pendingnew

You're right :( sorry and thanks a lot for the insight!!

comment:3 Changed 5 years ago by ben hockey

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.