Categories | Question details Back To List | ||
Sorting Hi Sorting does not work for date, and amount with dollar sign, I am using dom4j to create an XML file to pass to loadXMLString treeGrid method. Any help would be greatly appreciated please find my below code mygrid = new dhtmlXGridObject('gridbox'); mygrid.imgURL = "<%=request.getContextPath()%>/secure/images/"; mygrid.selMultiRows = true; mygrid.attachEvent("onRowSelect",doOnRowSelected); mygrid.enableCellIds(true); mygrid.setHeader("<span class=''><bean:message key='vehicleDailyStatement.asOfPriorEOD'/> </span>, , ,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.principal'/><br><html:label key='vehicleDailyStatement.balance'/></span>,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.units'/></span>,<span class='reportHeadLeft'><html:label key='vehicleDailyStatement.description'/></span>,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.interest'/></span>,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.flats'/></span>,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.insurance'/></span>,<span class='reportHeadRight'><html:label key='vehicleDailyStatement.fees'/><span>,<span class='reportHeadCenter'><html:label key='vehicleDailyStatement.floor'/><br><html:label key='vehicleDailyStatement.floordate'/></span> ,<span class='reportHeadCenter'><html:label key='vehicleDailyStatement.maturity'/><br><html:label key='vehicleDailyStatement.maturitydate'/></span>,<span class='reportHeadCenter'><html:label key='vehicleDailyStatement.duplicate'/><br><html:label key='vehicleDailyStatement.COV'/></span>,<span class='reportHeadCenter'><html:label key='vehicleDailyStatement.subvened'/></span>,<span class='reportHeadCenter'><html:label key='vehicleDailyStatement.stock'/><br><html:label key='vehicleDailyStatement.number'/></span>"); mygrid.setInitWidthsP("21,1,1,8,4,12,8,8,7,7,7,6,3,3,6"); mygrid.setColAlign("left,left,left,left,left,left,left,left,left,left,left,left,left,left,left"); mygrid.setColTypes("tree,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ch,ch,ro"); mygrid.setColSorting("na,str,str,int,int,str,str,str,str,date,date,date,na,na,str"); <% Document document = DocumentHelper.createDocument(); Element rowsElement = document.addElement("rows"); Element rowElement = rowsElement.addElement("row"); rowElement.addAttribute("id", "vehicleDailyStatementInq").addAttribute("bgColor", "#e6f6f7");//setText("<span class='sectionTotal'>"+ " "+"</span>" ); Element cellElement = rowElement.addElement("cell"); String xpath = request.getContextPath(); if(dlrOpen) cellElement.addAttribute("image","contract.gif"); else cellElement.addAttribute("image","expand.gif"); String navAway = StringUtils.buildNavigateAway("dealerSummaryInq", "dealerSummaryInq", true, dealerKey); cellElement.setText("<a href= \"#\" id = \"NavigateAway\" ><span class='sectionTotal'>" + vehicleDailyStmtDetail.getDealerName()+ "</snap></a>"); // cellElement.setText(vehicleDailyStmtDetail.getDealerName()); // cellElement.addAttribute("image","expand.gif"); rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getPrincipalBalAmt()+"</snap>"); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getUnits()+"</snap>"); //rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getInterestAmt()+"</snap>"); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getFlatsAmt()+"</snap>"); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getInsuranceAmt()+"</snap>"); rowElement.addElement("cell").setText("<span class='sectionTotal'>"+vehicleDailyStmtDetail.getFeesAmt()+"</snap>"); rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").setText(" "); rowElement.addElement("cell").addAttribute("disabled", "true").addAttribute("id","Dcov"); rowElement.addElement("cell").addAttribute("disabled", "true").addAttribute("id","Subv"); rowElement.addElement("cell").setText(" "); String strDOM =document.asXML().replaceAll("\"", "'"); %> Answer posted by Support on Oct 09, 2008 02:00 >>Sorting does not work for date The default "date" sorting accepts dates in js compatible format only. ( which is mm/dd/yyyy ) If you are using any other format you can - use dhxCalendar column type and setDateFormat - use custom sorting routine ( http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Sorting_in_grid.html#grid_art_sort ) >>and amount with dollar sign You can - use price column type and just a number in XML - use ron|end columnt type and setNumberFormat - use custom sorting routine ( http://dhtmlx.com/docs/products/dhtmlxGrid/doc/articles/Sorting_in_grid.html#grid_art_sort ) Answer posted on Oct 09, 2008 15:07 Thanks for quick reply As suggest i used ron with number Format but still i dont see columns sorting correctly any suggestion? mygrid.setNumberFormat("0.00","6"); mygrid.setColAlign( "left,left,left,left,left,left,left,left,left,left,left,left,left,left,left,left");mygrid.setColTypes( "tree,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ro,ch,ch,ro,ro");mygrid.setColSorting( "na,na,na,int,int,str,ron,ron,ron,ron,date,date,na,na,int,int");Answer posted by Support on Oct 10, 2008 04:59 mygrid.setColTypes("tree,ro,ro,ro,ro,ro,ron,ro,ro,ro,ro,ro,ch,ch,ro,ro"); mygrid.setColSorting("na,na,na,int,int,str,int,ron,ron,ron,date,date,na,na,int,int"); |