Author Topic: Displaying more than one grid at the same page  (Read 484 times)

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Displaying more than one grid at the same page
« on: October 28, 2022, 09:00:40 pm »
When I try to create a page that uses the PQGrid grid control more than once on the same page, the page loads fine, but the grid data is only displayed one of the grids.

Is there a way to display multiple grids on the same "tabbed" page??

Thanks,
Peter
« Last Edit: October 28, 2022, 09:19:11 pm by pbassey »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Displaying more than one grid at the same page
« Reply #1 on: October 28, 2022, 09:35:54 pm »
Any number of grids can be displayed on a single page.

Every grid should have independent initialization options and data.

Example: https://paramquery.com/pro/demos/copy_paste

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Displaying more than one grid at the same page
« Reply #2 on: November 04, 2022, 11:52:03 pm »
Can you provide an example where there are 2 grids on the same html page - both importing from 2 different excel files and both are loaded with data in the 2 grids at the same time on that same html page??

pbassey

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Displaying more than one grid at the same page
« Reply #3 on: November 05, 2022, 02:13:02 am »
Can the importXL function be integrated into the following code (below) so the dataModel points to an Excel file rather than data from the generateData function?

        function getObj( index ){
            var rows = 20,
                cols = 10,
                skipHiddenCols, 
                skipHiddenRows,
                includeHeader,            
                toLetter = pq.toLetter,               
                data = index == 0? pq.generateData(rows, cols): [],
                CM = [];

            for (var i = 0; i < cols; i++) {
                CM = { title: toLetter(i), width: 155 };
            }           

            var obj = {
                showTitle: false,
      height: 500,
      colModel: CM,
      dataModel: {data: data}                               
            };

            return obj;
        }
        pq.grid("#KPMGData", getObj(0));


paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: Displaying more than one grid at the same page
« Reply #4 on: November 06, 2022, 05:50:49 pm »
grid API can't point directly to Excel file.

First Excel file is imported into grid and updated grid data can be exported back to original Excel file as mentioned here:

https://paramquery.com/forum/index.php?topic=4478.msg16085#msg16085