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..
Hello Sergio,
Thank you for your feedback.
I will revise this further and I will notify you if enabling load on demand could affect batch updating in the igHierarchicalGrid.
I will get back to you as soon as I am ready.
Hi, thanks for responding to my question.
using the example descibed i made the changes according to the link refered above..
sorry if my question above was not very well described..
with both examples the diference that i detect is related to batch updates,,,
what i want to know if the problem is real (maybe i did some mistake.), i mean, if i load all data i can not do batch updates, if i use load on demand i can do batch updates?
i am asking this because the same model ,one with load on demand and another with load all, why can i do bacth updates if using load on demand capability, or if using load all i cant do it...
Load on demand could be used both with oData Protocol and without it. The feature is available both in the MVC wrapper and by using pure jQuery without the wrapper. Data retrieving is internally implemented so, as I mentioned in my previous post, all you should do to enable load on demand is adding its declaration in the features section:
.Features(features =>
{
…
features.LoadOnDemand();
})
To your comment regarding the save changes implementation - have you tested this sample?
http://igniteui.com/hierarchical-grid/editing-dataset
If anything new comes up feel free to also add it to the thread.
now i am completly lost...
i have created a project using mvc and EF4.0
i was following this example http://es.infragistics.com/community/blogs/damyan_petev/archive/2012/02/15/jquery-hierarchical-grid-load-on-demand.aspx
and i according to this we can achive load on demand from mvc helper or by jquery, but to use it with jquery i need to use oData Protocol?am i wrigth?
now when i created this topic i was using a hierarchical grid that load all data on initialization, then i add the enable add row for both parents and child rows..
when savechanges method was called if the changes was only a child row, or a father row, it was detecting the data, and we could see that the value of the layout field was diferent ...father was null, and the child was Produtcs, but when i tried to do batch updates (ie add father row, then add a child row) it was only detecting the information about the father..
i now created a new project using hierarchicalgrid and load on demand capability, and if i do some batch updates it detects both changes...
so basically, if i use load on demand with hierarchiclagrid i can do batch updates, if i use load all it is not possible to do batchupdates,althoug it detects the changes if i do one thing at a time (add father row then call save changes, or add child row then call save changes)?
am i right?
thanks
Thank you for your reply.
A sample presenting batch updating for both parent and child grid rows could be found in the following resource:
To your question regarding the LoadOnDemand feature it could be enabled by the following code:
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.