Hi, i was tryind to do a add row to a hierarchical grid, using the api available.
The problem is that when when i add a root row , and then call savechanges it detects the root row and add it to the database, if i try to add a child row it ig_transactions come empty according to firebug.
if i add a new father row, then add a child row to another father, the ig_transactions comes with a miscellanious info about..
i am using your example of ighierarchicalgrid
i add the add row features to root row and child row..
so in this first image we can see the grid and the grid is load with some info.
i then press add new row, and add a root row with some data, then i press the save button that call me the a action defined in UpdateUrl(Url.Action("save"))
the method save is called and the ig_transaction has this value
ig_transactions[{"type":"newrow","tid":"4eb2","row":{"ig_pk":5,"ID":1,"Name":"sasa","IsActive":false},"rowId":5}]
[{"type":"newrow","tid":"4eb2","row":{"ig_pk":5,"ID":1,"Name":"sasa","IsActive":false},"rowId":5}]
lets try that with 2 root rows
[{"type":"newrow","tid":"4eb2","row":{"ig_pk":5,"ID":1,"Name":"sasa","IsActive":false},"rowId":5},{"type":"newrow","tid":"a14f","row":{"ig_pk":5,"ID":2,"Name":"sasas","IsActive":false},"rowId":5}]
[{"type":"newrow","tid":"4eb2","row":{"ig_pk":5,"ID":1,"Name":"sasa","IsActive":false},"rowId":5},{"type"
:"newrow","tid":"a14f","row":{"ig_pk":5,"ID":2,"Name":"sasas","IsActive":false},"rowId":5}]
from this lines of ig_transaction we can see that we are creating new rows with some info inside..
but we can also see that ig_pk is 5(infragistis grid primary key is that???)what is the meaning of this vallue 5 and the meaning ig_pk?
but this is not the only problem/doubt that i have...
the second image i am trying to add a root row, and then i am trying to add a child row to the root row number 2..
if i press save te ig_transacation send this [{"type":"newrow","tid":"d880","row":{"ig_pk":5,"ID":6,"Name":"sasas","IsActive":false},"rowId":5}]
[{"type":"newrow","tid":"d880","row":{"ig_pk":5,"ID":6,"Name":"sasas","IsActive":false},"rowId":5}]
as you can see it only send the information regarding the root row that was added,,,
what is the problem...
in the ig_transactions it should send the info about the 2 rows, the parent and the child row..
the method save is something like this
[ActionName("save")] public ActionResult save() { GridModel m = new GridModel(); JsonResult result = new JsonResult(); Dictionary response = new Dictionary(); List ListCustomer = new List(); ViewData["GenerateCompactJSONResponse"] = false; List<Transaction> categoryTransactions = m.LoadTransactions(HttpContext.Request.Form["ig_transactions"]); foreach (Transaction t in categoryTransactions) { } List<Transaction> productTransactions = m.LoadTransactions(HttpContext.Request.Form["ig_transactions"]); foreach (Transaction t in productTransactions) { } result.Data = response; return result; }
i have uploaded a example project with clients and produtcs..
after seeing your responses i did some testing...
so the problem appears if i do batch updates, but if i save the information every time i do a add, delete or update and then call save changes it is now possible...
it detects if the row is a child row or a father row, depending on the value of the layout...
but if i do some batch updates change a child row and then change a father row, it only return the change on the father grid...
one other thing that i though i should try is grid load on demand...but i will create a new project see what comes up..
is it possible instead of using the model in a direct way, create a view model with the info that i want?
Hello Sergio,
Thank you for your reply.
A sample presenting batch updating for both parent and child grid rows could be found in the following resource:
http://igniteui.com/hierarchical-grid/editing-dataset
To your question regarding the LoadOnDemand feature it could be enabled by the following code:
.Features(features =>
{
…
features.LoadOnDemand();
})
More information on this feature could be found in the following resource:
http://help.infragistics.com/Help/Doc/jQuery/2013.2/CLR4.0/html/igHierarchicalGrid_Load_on_Demand.html
Using domain model or view model does not affect the grid behavior. It is a design decision and since the data passed by the controller corresponds to the model associated to the view the project is expected to work correctly. You might be interested in reading through the thread below:
http://stackoverflow.com/questions/11064316/what-is-viewmodel-in-mvc
Hope this helps. If you have any further questions feel free to contact us again.