Author Topic: How can I show the same grid multiple times on html page?  (Read 3468 times)

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
How can I show the same grid multiple times on html page?
« on: May 19, 2014, 07:19:24 pm »
Hi Paramvir,
I have a grid on one page that depends on condition I have to repeat a few times.
Is there any easy way to show a grid with same name multiple times without copying the js file and rename the grid?
Thanks a lot,

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How can I show the same grid multiple times on html page?
« Reply #1 on: May 19, 2014, 08:18:27 pm »
Do you mean by HTML name attribute or variable name of the grid instance i.e., $grid ?

you could deep clone the initialization object i.e., the object passed to pqGrid constructor and create as many grid instances as required with it.

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Re: How can I show the same grid multiple times on html page?
« Reply #2 on: May 19, 2014, 09:01:26 pm »
Oh Great Idea,
I just need to show the same grid multiple times on the same html page with more efficient way as possible.
There is some data repetition and depends on situation we ask user to enter the same data multiple times.

Any chance you can give me a small example of deep clone of grid init object and how do I use it on the page?

Thanks a lot

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6263
    • View Profile
Re: How can I show the same grid multiple times on html page?
« Reply #3 on: May 19, 2014, 11:29:24 pm »
Please see the line 58 in this demo http://paramquery.com/pro/demos/nesting

Code: [Select]
  var objCopy = $.extend(true, {}, gridDetailModel);

which deep clones the constructor object of the detail grid instances. $.extend is part of jQuery API

stoodin

  • Pro Enterprise
  • Jr. Member
  • *
  • Posts: 85
    • View Profile
Re: How can I show the same grid multiple times on html page?
« Reply #4 on: May 20, 2014, 12:37:39 am »
Great,
Thanks a lot. I did it and it works.