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:
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 220.127.116.11 as well as IE7. Any idea what I’m doing wrong? Thanks!
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.
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
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: dhtmlx.com/docs/products/docsExp … ndex.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!
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!
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!!
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 email@example.com )
Ah, thanks, I wasn’t specifying the height. Using gridHeight worked. WooHoo!!