Hi,
I was trying to populate the data retreive from the database and display it in the JSP using JSONArray. The data however is displayed but the the data doesn’t aligned with the header. Also the default sort image is always displayed in the first field where it should be in the second field. Below is my code:
brandingTableGrid = new dhtmlXGridObject(‘brandingGrid’);
brandingTableGrid.setImagePath("${pageContext.request.contextPath}/codebase/imgs/");
brandingTableGrid.setHeader(",Branding Name,Parent Group ID,Address,Days and Hours of Operation,Customer Service Phone Number,");
brandingTableGrid.setColumnIds(“sel,brandingName,groupId,address,daysHoursOfOperation,phoneNumber,edit,delete,audit”);
brandingTableGrid.setInitWidths(“5,15,12,20,15,15,5,5,8”);
brandingTableGrid.cellWidthType = “%”;
brandingTableGrid.setColAlign(“center,left,left,left,left,left,left,left,left”);
brandingTableGrid.enableTooltips(“false,false,false,false,false,false,false,false,false”);
brandingTableGrid.setColTypes(“ro,ro,ro,ro,ro,ro,ro,ro,ro”);
brandingTableGrid.setSkin(“light”);
brandingTableGrid.setColSorting(“na,str,str,str,str,str”);
brandingTableGrid.init();
brandingTableGrid.parse(buildJSONData(’${responseBean.brandingJson}’), ‘json’);
brandingTableGrid.setSizes();
brandingTableGrid.setSortImgState(true, brandingTableGrid.getColIndexById(“Branding Name”), “asc”);
Please help. Thanks in advance.
Jojit
>>the data doesn’t aligned with the header
Problem can’t be reconstructed, please check attached sample - it uses the same code and works correctly.
Please be sure that you not using any global styles, which modify TD,TR,TABLE,DIV tags rendering.
>>where it should be in the second field
You are mixing column header and column ID, the correct command will be
brandingTableGrid.setSortImgState(true, brandingTableGrid.getColIndexById(“brandingName”), “asc”); // same as in setColumnIds
1220950944.zip (85 KB)