Author Topic: Duplicate entry in addList & updateList when adding new row.  (Read 2725 times)

francis6425

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Duplicate entry in addList & updateList when adding new row.
« on: April 06, 2017, 08:06:43 pm »
Hi,

When ever I tried to add new rows to grid with a string column as its primary key column, there will be duplicate entry in both addList and updateList. For grid with auto incremental primary key column, I do not have this problem.

Attached test.txt is the code that I've used.
I've also attached 2 image.

Image 1 is after I press the add new row button and then type in the primary key. After that I press get Changes to confirm that it only exists in addRow.

Next I enter some text in the second column and then press the get Changes button again. And this time it shows that it appears in both addList and updateList. There is no red icon on the primary key column but there is red icon on the 2nd column.

Please advise on what is wrong.


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Duplicate entry in addList & updateList when adding new row.
« Reply #1 on: April 07, 2017, 11:16:43 am »
Ok I see your point.

A row is considered a new row by the grid until its recIndx is empty.

Since you want the primary key to be editable by the user, just make the recIndx and primary key separate. Let's call one primary key and the another one just a column with unique values.

You can keep recIndx column hidden and fill out its value ( auto incremental number or some unique key string ) when data payload is sent to the server by grid. That would satisfy both grid and user.

Hope it helps.

francis6425

  • Pro Deluxe
  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Duplicate entry in addList & updateList when adding new row.
« Reply #2 on: April 18, 2017, 06:12:46 pm »
Thanks for your advise.
It is working well as suggested.