xDHTMLx :: 2 subgrids in the same grid

Hi, I want to have 2 subgrids in the same grid. Is this possible? How can I write this in my XML grid source?



Thanks a lot!


Hello


grid can have only one subgrid in a row.


So using 2 subgrid columns isn’t possible

So, it is impossible to make subgrid 1 – for column 1 in mygrid, and subgrid 2 – for column 2 in mygrid and so on?

It is not possible.
You can have one subgrid for row-1, and different subgrid for row-2, but you can’t have different subgrids for different columns in the same row.

So, what could you advise to do if I have main grid with 2 columns, values for one column I chose from one subgrid, and values for second column I want chose too, but from another table in database. May be there are another way, not by implementing subgrid, to get select box with values from that table?

I’m not sure that we are talking about the same feature.
Above limitation is applied for subgrids
docs.dhtmlx.com/doku.php?id=dhtmlxgrid:sub-grids

If you need to use the grid as editor ( selector ) for data, you can use grid editor, in case of which, you can configure different grid editors for different columns

dhtmlx.com/docs/products/dht … _grid.html

Yes, i try use 2 grids as editors to select values from them in 2 columns of one row. But how:

[code]subgrid = new dhtmlXGridObject(‘gridbox_sub’);
subgrid.setImagePath("…/…/codebase/imgs/");
subgrid.setHeader(“Name,UID,Total count”);
subgrid.setInitWidths(“100,100,100”);
subgrid.enableAutoHeight(true);
subgrid.setColTypes(“ro,ro,ro”);
subgrid.init();

subgrid2 = new dhtmlXGridObject(‘gridbox_sub2’);
subgrid2.setImagePath("…/…/codebase/imgs/");
subgrid2.setHeader(“Name,UID,Total count”);
subgrid2.setInitWidths(“100,100,100”);
subgrid2.enableAutoHeight(true);
subgrid2.setColTypes(“ro,ro,ro”);
subgrid2.init();

subgrid.loadXML("…/common/authors.xml", function() { // ??? <- here is only subgrid
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath("…/…/codebase/imgs/");
mygrid.setHeader(“Sales, Book Title, Author,Price,In Store,Shipping,Bestseller,Date of Publication”);
mygrid.setInitWidths(“50,150,100,80,80,80,80,200”);
mygrid.setColAlign(“right,left,left,right,center,left,center,center”);
mygrid.setColTypes(“dyn,ed,grid,price,ch,co,ra,ro”);
mygrid.setSubGrid(subgrid, 2, 0);
mygrid.init();
mygrid.loadXML("…/common/grid_authors.xml");
});[/code]

You can issue mygrid.setSubGrid many times

mygrid.setSubGrid(subgrid, 2, 0); mygrid.setSubGrid(subgrid2, 3, 0);

Also, you need to load both subgrids and init master grid only after that.