Categories | Question details Back To List | ||
dhtmlXGridFromTable not working for me I am trying to use dhtmlXGridFromTable and not having any luck at all. We are using asp (I know, it's very old technology) to generate our pages. We are just getting started with AJax and also wanted to incorporate these DHTMLX tools. My page that's not working is as follows... ____________________________________________________________________________________________ <!--#include virtual="/ASPLib/DSGLib.asp"--> <!--#include virtual="/ASPLib/NGFunctions.asp"--> <!--#include virtual="/ASPLib/ASPFunctions.asp"--> <!--#include virtual="/ASPLib/ASPPDF.asp"--> <!--#include virtual="/ASPLib/ADOVBS.asp"--> <% Session("PC") = request("PC") %> <!--#include file="ProjectHdr.asp"--> <script src="/asplib/dhtmlxgrid_start.js"></script> <script type="text/javascript"> var mygrid = new dhtmlXGridFromTable('tblToGrid'); </script> <% Set cn = Server.CreateObject("ADODB.Connection") cn.Open Session("AppConn") sql = "Select * from base " sql = sql & "where 1=1 " sql = sql & "and PerfCharge = '" & request("PC") & "' " sql = sql & "and origin = 'Input' " sql = sql & "and lbrType <> 'NL' " sql = sql & "order by emplName" Set rs = Server.CreateObject("ADODB.Recordset") rs.CursorLocation = adUseClient rs.Open SQL, cn, 2, 3 %> <table name="tblToGrid" style="width:400px"> <tr> <td> Employee </td> </tr> <% while not rs.EOF %> <tr> <td> <%=rs("EmplName")%> </td> </tr> <% rs.movenext wend %> </table> <% %> ____________________________________________________________________________________________ It's a very simply HTML table that I was hoping to convert to dhtmlXGrid. Once I get it working, I will elaborate on the table. For now, I just want it to display to confirm that it's working. So far, the output is exactly the same as just a normal HTML table. And, when I debug it, the message is as follows... obj has no properties dhtmlXGridFromTable(null, undefined)dhtmlxgrid_start.... (line 13) [Break on this error] w.setAttribute("width",obj.getAttribute("gridWidth")||(obj.offsetWi... Any help would be much appreciated. Answer posted by Support on May 12, 2008 03:16 In your code snippet the dhtmlXGridFromTable command executed before table really rendered, so the command can't locate it and convert to grid. Problem can be solved by - moving command after code which output HTML code of table or - adding code, to launch conversion only after document loading <script type="text/javascript"> dhtmlxEvent(window,"load",function(){ var mygrid = new dhtmlXGridFromTable('tblToGrid'); }); </script> |