Categories | Question details Back To List | ||
Data grid does not do sorting Hi there, I v got a problem in my data grid: by default, data grid can do the sorting task simply by a single click at the header. However, my grid does not have this. I tried to create a new simple page to try, but this time, the page does not even display the grid. please help! here is my code: <%@ Page Language="C#" AutoEventWireup="true" Codebehind="TestWebForm.aspx.cs" Inherits="VSAReporting.TestWebForm" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>Test DHTMLX Grid</title> <link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxGrid/codebase/dhtmlxgrid.css" /> </head> <body> <form id="form1" runat="server"> <script src="dhtmlx/dhtmlxGrid/sources/dhtmlxcommon.js" type="text/javascript"></script> <script src="dhtmlx/dhtmlxGrid/sources/dhtmlxgrid.js" type="text/javascript"></script> <script src="dhtmlx/dhtmlxGrid/sources/dhtmlxgridcell.js" type="text/javascript"></script> <%-- <script src="dhtmlx/dhtmlxGrid/sources/ext/dhtmlxgrid_srnd.js" type="text/javascript"></script>--%> <div id="gridContainer" style="width: 100%; height: 200"> </div> <script type="text/javascript"> var mygrid = new dhtmlXGridObject('gridContainer'); mygrid.setImagePath("dhtmlx/dhtmlxGrid/codebase/imgs/"); mygrid.setHeader("Exec ID,User Name,Module Code, Command Code, Begin Date, Status, MarMachine Name, Name Admin Login As"); mygrid.setInitWidths("*,*,*,*,*,*,*,*"); mygrid.setColAlign("center,center,center,center,center,center,center,center"); mygrid.setSkin("modern"); //mygrid.setSkin("sgcib"); mygrid.setEditable(false); //mygrid.enableSmartRendering(true); mygrid.init(); mygrid.loadXML("data.xml"); </script> all the reference in this page is correct as well as the xml file. firebug does not report any error. Thanks! </form> </body> </html> Answer posted by dhxSupport on Apr 02, 2009 06:58 Problem occurs because of you doesn't set correct height to the grid container <div id="gridContainer" style="width: 100%; height: 200px"> >>by default, data grid can do the sorting task simply by a single click at the header. However, my grid does not have this. Add setColSorting method to the grid init: mygrid.setColSorting("int,int,int,int,int,int,int,int"); Avalible sorting types: str, int, date, na or function object for custom sorting |