Hi,
I am trying to do something Dynamic with the JqXGrid and SQL, and I wonder if it is Possible.
In My Code Below I would like to pass an array of Column Names to the Function on order to build the headers in the columns: section….
Since I don’t know how many columns will be in my Array, I thought about looping and dynamically create each header…but it gives me an error message the minute I add the For Loop. Maybe I am doing this completely Wrong…but anybody know if it is possible with JqxGrid? If Yes, can you assist me with it please?
Thanks a lot.
<script type="text/javascript">
function DynamicGrid(array)
{
$("#DynamicGrid").jqxGrid(
{
width: 850,
//source: dataAdapter,
columnsresize: true,
columns:
[
{for (j = 0; j < array.length; j++) {
{ text: array[i], datafield: array[i], width: 250 },
}
]
});
}
</script>