tonytomov / jqGrid

jQuery grid plugin
www.trirand.com
2.84k stars 1.2k forks source link

Adding Multiple headers in Jqgrid #943

Closed iamarshad closed 5 years ago

iamarshad commented 5 years ago

How to add two levels of header in Jqgrid. I need the first level of Header for the Titles and the second level of the header for displaying total sum values in the grid.

tonytomov commented 5 years ago

Hello,

Call setGroupHeaders two times - one time for the titlea and other time for the summaries. Just test it

iamarshad commented 5 years ago

HI tonytomov. Thanks, I tried using setGroupHeaders , For Titles, its working, and for displaying the total values of the jqgrid, its not working. I tried using SetGroupHeaders and SetLabels, its not working as well

This is the code :+1:

for (var i = 0; i <= mydata.length; i++){ grid.jqGrid('addRowData', i + 1, mydata[i]); }

grid.jqGrid('setLabel', "SONO"," ");
grid.jqGrid('setLabel', "DESCJ1","Total");
grid.jqGrid('setLabel', "TQOD", "colSum");
grid.jqGrid('setLabel', "QTFT", sumQTDL);
grid.jqGrid('setLabel', "QTOC", sumQTDL);
grid.jqGrid('setLabel', "QTWH", sumQTDL);
grid.jqGrid('setLabel', "QTDL", sumQTDL);
grid.jqGrid('setLabel', "OQOD", sumQTDL);

grid.jqGrid('setGroupHeaders', { useColSpanStyle: false, groupHeaders : [ { startColumnName:'SONO', numberOfColumns:1, titleText:'Item No.' }, { startColumnName:'DESCJ1', numberOfColumns:1, titleText:'Description' }, { startColumnName:'TQOD', numberOfColumns:1, titleText:'Total Order Qty' }, { startColumnName:'QTFT', numberOfColumns:1, titleText:'Made & At Factory' }, { startColumnName:'QTOC', numberOfColumns:1, titleText:'On Ocean' }, { startColumnName:'QTWH', numberOfColumns:1, titleText:'In W/H' }, { startColumnName:'QTDL', numberOfColumns:1, titleText:'Shipped to WF' }, { startColumnName:'OQOD', numberOfColumns:1, titleText:'Open Qty' }

] });

The ColSum1 and sumQTDY are the total values added frm grid

tonytomov commented 5 years ago

I really do not understand what you try to do.

Can you please show me with picture wheat is your goal? How the grid should look like?

Thanks

iamarshad commented 5 years ago

Capture Hi Tony, U see in this picture, I have created 2 headers, I have used the first header for Titles, and i need the second header to have the total values of their respective columns. I have that already in the footer, But it has to be presented on top. And do you know that if there is anyway that we might include Mysql query in Jqgrid

tonytomov commented 5 years ago

The upcoming release will support this feature. What is the problem with your code? This should work or your totals does not appear?

iamarshad commented 5 years ago

The problem with my code here is I don't know how to display these totals in header.

tonytomov commented 5 years ago

With setLabels as you do this should work.

The problem that I see is from where you get these values ColSum1 and sumQTDY and when you set the labels. Question - From where is the value of colSum1?

tonytomov commented 5 years ago

As for the Mysql binding you can do this. Since Guriddo jqGrid is commercial product I recommend you to use our other commercial Suito PHP. Demo here: http://www.guriddo.net/demo/demos/jqgrid/ and more on this product you can find on our http://www.guriddo.net site

tonytomov commented 5 years ago

The feature is added: https://github.com/tonytomov/jqGrid/commit/e75e5eb928b3c80fbce3a3d61d1ff935374e654a