Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Add row to to hierarchical grid using api(adding child row to subgrid and add father row)
posted

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.

grid sample

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}]

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}]

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...

grid sample 2

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}]

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..

IgHierarchicalGrid_Model.zip
Parents
No Data
Reply
  • 445
    posted

    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?

Children