I get my primary key after I insert a new record for the newly created record. If I refresh the page, I get all data fine but I dont want to refresh the entire page. I tried to do $('#mygrid').igGrid("dataBind") but this just bind the grid data what we have already on the page. New record is still not loaded with new primarykey which is returned from database.
How do I bind the primary key with the grid and new record? Please help.
Hello Sarojanand,
From your description is not clear whether you're using the igGrid MVC helper wrapper for data binding as well as updating. If you use it calling igGrid.dataBind will make a remote request and refresh the primary key values, but you said this is not the case. In order for me to understand your scenario can you provide more information on:
Are you using igGrid MVC helper wrapper?
How do you bind igGrid to data? Is it remote data or local data? Do you make custom Ajax call to get the data?
How do you save updates made to igGrid (inserts, updates, deletes) to the database? Are you calling igGrid.saveChanges?
Do you have igGrid.updateUrl configured?
I've answered a similar question to yours, but the customer was using igGrid MVC helper wrapper. You can check the following forum post for an example of updating the PK value of newly created record on demand without the need for re-binding:
http://es.infragistics.com/community/forums/p/84192/420302.aspx#420302.
Hope this helps,Martin PavlovInfragistics, Inc.
I did implement your answer on http://es.infragistics.com/community/forums/p/84192/420302.aspx#420302 and now I can see the updated row with correct primary key. but a new strange problem came. When I try to update the row, all data in the row is disappeared. if I click on cancel button, I see the data again but to update the row I have to add all fields. Can you see can be the issue?
Also another problem, if I make my primary key field as ReadOnly so that nobody can edit it, I don't see the updated Key id anymore and old issue persist.
Hi Martin,
Yes I am using MVC helper wrapper for databinding. I have attached a txt file for you to have a look. All I want is when I add a new row, the product id (mvc action is returning it) should be binded with this so that I can instantly update the record without refreshing page / views. Update requires primary key.
Please have a look at the attached file and let me know where I am doing wrong and how to fix it.