Categories | Question details Back To List | ||
Error occurs when sorting Date on grid I have a date field which is formatted to dd/mm/yyy. I have set my grid up as follows: mygrid = new dhtmlXGridObject('itemlist'); mygrid.setImagePath("/scripts/codebase/imgs/"); mygrid.setHeader(",Name,Type,Date,Filename,"); mygrid.setInitWidths("30,*,80,70,*,70"); mygrid.setSizes(); mygrid.setColAlign("left,left,left,left,left,center"); mygrid.setColSorting("str,str,str,date,str,str"); mygrid.setColTypes("img,ro,ro,date,ro,link"); mygrid.enableMultiselect(true); mygrid.setSkin("modern"); mygrid.enableDragAndDrop(true); mygrid.enableResizing("false"); mygrid.init(); Since changing setColTypes to date I get an error "undefined" when I try to sort. If I setColTypes to "ro" then it doesn't error but doesn't sort correctly. Any ideas? John Answer posted by dhtmlx support on Sep 26, 2008 08:43 Grid can contain only one * as the column width. Also setHeader should set some content for each header cell. Try to change "" names to " ", for example. It will be better to include setSizes method after grid intialization (if it should be used): So, please, try to change the code in teh following way: mygrid = new dhtmlXGridObject('itemlist'); mygrid.setImagePath("/scripts/codebase/imgs/"); mygrid.setHeader(" ,Name,Type,Date,Filename, "); mygrid.setInitWidths("30,*,80,70,50,70"); mygrid.setColAlign("left,left,left,left,left,center"); mygrid.setColSorting("str,str,str,date,str,str"); mygrid.setColTypes("img,ro,ro,date,ro,link"); mygrid.init(); mygrid.enableMultiselect(true); mygrid.setSkin("modern"); mygrid.enableDragAndDrop(true); mygrid.enableResizing("false"); |