Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dixie on Mar 03, 2009 08:42
open dhtmlx forum
Frozen column for dhtmlXGridFromTable ?

Hi,

I have a HTML table as a base for a grid and I want to freeze the first column.
Something like this:
var table = new dhtmlXGridFromTable("myTable");
table.splitAt(1);

Is this possible ?

Cheers,
Dixie
Answer posted by dhtxSupport on Mar 03, 2009 09:15

You can use onbeforeinit table's attribute to execute splitAt() method. 

<table imgpath="../codebase/imgs/" style="width:400px" id="myTable" name="myTable" onbeforeinit="initGrid()">

...

</table>

<script>

table = new dhtmlXGridFromTable("myTable");

function initGrid(){

myTable.splitAt(1); //grid's name is reference to the grid. 

}

</script>

Answer posted on Mar 03, 2009 09:28
I tried it that way:

<!--- table to convert --->
<table id="myTable" class="myTable" style="width: 400px" onbeforeinit="initGrid()">
     <tr>
           <td sort="int" align="left" type="ed" width="150">value 23</td>
           <td>Column 2</td>
           <td>Column 3</td>
     </tr>
     <tr width="200">
           <td>Row 1 - Cell 1</td>
           <td>Row 1 - Cell 2</td>
           <td>Row 1 - Cell 3</td>
     </tr>
     <tr width="200">
           <td>Row 2 - Cell 1</td>
           <td>Row 2 - Cell 2</td>
           <td>Row 2 - Cell 3</td>
     </tr>
</table>

<script>
table = new dhtmlXGridFromTable("myTable");

function initGrid(){
     myTable.splitAt(0);
}

</script>


but i get the error: "myTable is not defined"

Any idea ?

Answer posted by Support on Mar 04, 2009 03:36
Change your code as
<table id="myTable" name="myTable"

also,   myTable.splitAt(0)  is an incorrect command, parameter of splitAt must be a valid index value