Sanjiv,

It has been a few months since you made this post, but I have come up with a
method to create the colNames and colModel dynamically.

Here's an example of how to do it in JavaScript:

    var NameList = new Array();
    NameList.push("'Id'");
    NameList.push("'Name'");
    NameList.push("'Description'");
    var NameListArg = '[' + NameList.toString() + ']';

    var ColList = new Array();
    ColList.push("{ name: 'id',index:'id',width:55,resizable:true}");
    ColList.push("{ name: 'name',index:'name',width:90,resizable:true}");
    ColList.push("{ name:
'description',index:'description',width:120,resizable:true}");
    var ColListArg = '[' + ColList.toString() + ']';

Then in your jqGrid() call use these parameters:

    colNames: eval(NameListArg),
    colModel: eval(ColListArg ),

Notice that each column name is surrounded by single quotes. 

Hope this helps,

CarmelFrank

>Is there a ready made solution for using jqGrid by querying column
>metadata from the server. I want to create a generic grid where the
>colModel and colNames are not fixed and are be created dynamically by
>querying the server.

-- 
View this message in context: 
http://www.nabble.com/jqGrid-Metadata-tp17139298s27240p20967965.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to