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.
Hi Dimka,
I marked this as answer for grid related issues however I have posted another query for igHtmlEditor. I am trying it online on your website in IE 9 and some toolbar functions like redo/undo etc. doesn't work. Same thing is happening when I am using it locally.
Can you please see that?
Hello Sarojanand,
I am following up to check if you have any further questions. If so, don’t hesitate to contact us again.
sarojanand@gmail.com said:Just a quick question - why I cant use grid.igGrid("dataBind") instead of creating separate method like rebindGrid(data) what I m doing? Am I calling it on wrong event?
Of course you can, but this requires different grid configuration which includes setting .DataSourceUrl() and adding a new controller action decorated with GridDataSourceAction attribute. Attached you can find the Addresses.cshtml and BusinessAssociateController.cs. These are the files which I modified in order to demonstrate this scenario. Note that by default all grid features in this case will be remote. However I do not recommend you to use re-binding (calling igGrid.dataBind method), because it has 2 drawbacks:
1. It reloads the current page, which is unnecessary network traffic.
2. It causes a flickering which will probably annoy the user.
sarojanand@gmail.com said: Another issue, sometime when I edit a row, List<Transaction<Address>> transactions = gridModel.LoadTransactions<Address>(HttpContext.Request.Form["ig_transactions"]); transaction.Count shows 0. This doesn't happen everytime. Next time you submit and it works fine. Any idea why its causing this issue?
Another issue, sometime when I edit a row,
List<Transaction<Address>> transactions = gridModel.LoadTransactions<Address>(HttpContext.Request.Form["ig_transactions"]);
transaction.Count shows 0. This doesn't happen everytime. Next time you submit and it works fine. Any idea why its causing this issue?
I haven't seen such a behavior. I suspect that it can be a timing issue. You can try to use setInterval function to delay the igGrid.saveChanges method execution.
Here is an example:
Hope this helps,Martin PavlovInfragistics, Inc.
Hi Martin,
Thank you very much, it worked.
Just a quick question - why I cant use grid.igGrid("dataBind") instead of creating separate method like rebindGrid(data) what I m doing? Am I calling it on wrong event?
The problem was in the rebindData JavaScript function in the Addresses.cshtml. The data.AddressKey variable is a string, thus when you set this value in the grid you got a data type mismatch and the result is empty editors. That's why you need to call parseInt on data.AddressKey in order to make it number.
Here is the modified version (in bold is the modification which I made):
//update new id to new rowfunction rebindGrid(data) { if (typeof data.AddressKey != 'undefined') { grid.igGridUpdating("setCellValue", recOldID, "AddressID", parseInt(data.AddressKey)); $("#ba_addresses > tbody > tr[data-id='" + recOldID + "']").attr("data-id", data.AddressKey); grid.data("igGrid").dataSource.commit(); grid.data("igGrid").dataSource.allTransactions().length = 0; }}
Best regards,Martin PavlovInfragistics, Inc.