Categories | Question details Back To List | ||
dhtmlXGridFromTable I'm trying to use the dhtmlXGridFromTable to convert an existing table but it isn't working. Maybe I'm not understanding the documentation correctly. I thought this would take an existing table and create a dhtmlxgrid from it with clickable column headings to sort the table, etc. Is that not the case? Following the documentation my html file has just the script call and a very simple table: <head> <script src="/javascript/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script> </head> <body> <table class="dhtmlxGrid"> <tr> <td>column 1</td> <td>column 2</td> </tr> <tr> <td>value 11</td> <td>value 12</td> </tr> <tr> <td>value 21</td> <td>value 22</td> </tr> </table> </body> In FireFox running FireBug I get this error: dhtmlXGridObject is not defined dhtmlXGridFromTable(table#tbltogrid.dhtmlxGrid, undefined)dhtmlxgrid_start.... (line 7) dhx_init_grids()dhtmlxgrid_start.... (line 15) [Break on this error] obj = document.getElementById(obj);var w=document.createElement("DIV");w.setAtt... I'm running Windows XP Pro, IIS, FireFox 2.0.0.9 as well as IE7. Any idea what I'm doing wrong? Thanks! Rich Answer posted on Nov 27, 2007 02:34 You need to include all necessary files, dhtmlxgrid_start.js just a wraper which convert table to grid, but you need other functionality as well. <head> <script src="/javascript/dhtmlxGrid/codebase/ext/dhtmlxcommon.js"></script> <script src="/javascript/dhtmlxGrid/codebase/ext/dhtmlxgrid.js"></script> <script src="/javascript/dhtmlxGrid/codebase/ext/dhtmlxgridcell.js"></script> <script src="/javascript/dhtmlxGrid/codebase/ext/dhtmlxgrid_start.js"></script> </head> Answer posted by Richard Uchytil on Nov 27, 2007 09:56 I added all those but now it's not finding some things like sort_asc.gif. It's trying to grab it out of the same directory where the html file is. What do I need to change so it knows to get everything from /javascript/dhtmlxGrid/codebase/imgs? Is there some global setting that tells it where it is installed, what the default path is? Thanks! Answer posted by Support on Nov 28, 2007 02:12 By default grid expects to find image files in same directory where it was initialized - if you store them in separate directory ( common situation ) - you need to specify it during grid initialization, it can be done as <table class="dhtmlxGrid" imgpath="../../codebase/imgs/" optional imgpath attribute can point to image directory Answer posted by Richard Uchytil on Nov 28, 2007 07:37 Ah, I missed that in the code sample. Ok, now my images are displaying correctly, however I am not getting the scroll bars. I'm looking at the Initialize from HTML Table example on this page: http://dhtmlx.com/docs/products/docsExplorer/index.shtml and don't see anything that I don't have in my html. I've even done a view source and don't see what I'm missing. Thanks again! Answer posted by Richard Uchytil on Nov 28, 2007 07:45 Nevermind. I had the height set too big so there was plenty of room for the data to be displayed. As soon as I made the height really small the scrollbars appeared. Thanks for all the help! Now I'm anxious to start testing this cool grid! Answer posted by Richard Uchytil on Nov 28, 2007 08:25 Got this working and it's very cool - on FireFox and Safari windows beta. On IE6 and IE7 it doesn't show a small table with a scroll bar on the side, it displays the whole table and you have to scroll the page. I searched the kbase for IE6 and IE7 and nothing came up. Any idea's how to fix this? Opera 9 has the same problem though I'm not too concerned with that. Our corporate standard is IE6 right now so I need it to work there. Thanks!! Answer posted by Support on Nov 28, 2007 08:49 The problem may be in size detection, how you define your table height ? The grid initialization code checkes the "style:height","className:height", "height attribute", "height:attribute", ""gridHeight:attribute" In IE tables can automatically change value defined by height style or height attribute if it is smaller than necessary, so even if you set small height value on moment of initialization table takes bigger size, please try to define necessary height by <table gridHeight="XXXpx" .... If problem still occurs for you - please send any kind of sample ( you can send it directly to support@dhtmlx.com ) Answer posted by Richard Uchytil on Nov 28, 2007 10:42 Ah, thanks, I wasn't specifying the height. Using gridHeight worked. WooHoo!! |