Author Topic: How to loop thru multiple nested grid.  (Read 4413 times)

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
How to loop thru multiple nested grid.
« on: April 23, 2016, 05:59:50 pm »
Hi,

I have multiple nested grid i.e. detailModel,  so after 4 level of nesting user enters a value which I need to update.

My question if how can I loop thru the nested loop to get the value enter by the end user ?

Also the "track: true" option does not seem to work, as the demo show the red dot on the upper left end, but In my grid I donot see it and also the getChanges does not work.

Please advise on what I may be missing.

Thanks
GP

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #1 on: April 26, 2016, 08:56:39 pm »
For tracking, the primary key i.e., dataModel.recIndx is also required.

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #2 on: April 26, 2016, 09:16:59 pm »
Ok for tracking I shall verify the recIndx. Thx

So for nested grid, can i loop thru .each (dataModels ), if so do u have any example on this ? or u can send me a syntax on how can I do it.

The example ( http://paramquery.com/demos/nesting ), just show how to create but does not show how to navigate, do you have any documentation on this as well.

thx
Prabhu
« Last Edit: April 26, 2016, 09:22:40 pm by iamgsprabhu »

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #3 on: May 03, 2016, 12:38:23 am »
Can someone please tell me how can i loop thru the multiple dataModels to get the data enter in the last loop ? I donot see any documentation on this.

Can we loop thru .each (dataModels ), if so, do u have any example on this ? or u can send me a syntax on how can I do it.

The example ( http://paramquery.com/demos/nesting ), just show how to create but does not show how to navigate, do you have any documentation on this as well.

thx
Prabhu

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #4 on: May 03, 2016, 09:08:06 am »
Quote
Can someone please tell me how can i loop thru the multiple dataModels to get the data enter in the last loop ?

I'm not sure about your question. Probably a little bit elaboration of your use case/ requirement may help.

In case of nested grids, the usage of the API remains the same but for that understanding the context of callbacks/ event is important.

For example

1) if I want to invoke an API method let's say refresh() on a nested grid from a cellSave event of the same grid.

Code: [Select]
cellSave: function(evt, ui){
  $( this ).pqGrid( 'refresh' ); //this variable points to the DOM node of the same grid which fired the cellSave event.
}

2) If I want to invoke an API method let's say refresh() on a nested grid from click of a button or a control in the toolbar of the same nested grid.

Code: [Select]
click: function(evt, ui){
  $( this ).closest( ".pq-grid" ).pqGrid( 'refresh' ); //this variable points to the DOM node of the control.
}

Hope it helps.
« Last Edit: May 03, 2016, 09:14:13 am by paramquery »

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #5 on: May 05, 2016, 05:20:55 am »
Thank you for your very prompt response.

I have three levels of nested grid say:

+  Business Unit 1
    + Level 1
     - Level 2
       + Department 1
        - Department 2
              START Period    END PERIOD             PNL Data
              12/01/2014      02/28/2015             9,994,500       
              03/01/2015      11/30/2015             2,994,887
        - Department 3
              START Period    END PERIOD             PNL Data
              12/01/2014      02/28/2015             4,454,500       
              03/01/2015      11/30/2015             2,654,887
    + Level 3
+ Business Unit 2
....


Here is how my grid would look like and once the user enter the "Accept Change" Button, I want to pull up the PNL number along with the date range along with the hierachy information.

So my question to you is is there a way to loop (using callback) thru the nested grid and get the data enter by user, if so, how to use the callback function, is there a demo version where it is implemented similar kind of logic ?

cellSave also looks good, but in that case I will have to store it in an array the values entered, I wanted to get the data only when the User Click on Accept Change  button by looping thru hierachy to get the information.

Let me know if my description is not clear.

Thanks for your time and support.
Prabhu

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #6 on: May 06, 2016, 03:43:58 pm »
Any idea on how can I loop thru the grid to find the values entered by user in the innermost grid ( as shown in above post example ) ?

please advise.

iamgsprabhu

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: How to loop thru multiple nested grid.
« Reply #7 on: May 09, 2016, 07:00:55 pm »
Ignore my above question it looks like ParamQuery has already responded.

thx
Prabhu