jQWidgets Forums

jQuery UI Widgets Forums Grid jqxgrid header column text loaded dynamically

This topic contains 3 replies, has 2 voices, and was last updated by  technonaga 12 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • technonaga
    Member

    Hi Peter,

    I need one help in jqxgrid development. In grid column text (header) we were mentioned through hardcode. but , i need to change column text (header) displayed dynamically.

    For example :

    User 1, login in my app grid will appear :

    First Name | Last Name | Contact type | Phone | Address

    User 2,

    Last Name | Address | Phone | Contact Status

    User 3,

    Phone | First Name | Address | Last name| Contact Type

    I was used jqwidgets-ver2.0 , If any possible to change grid column text change based on user.

    Thanks & Regards,
    Naga


    Peter Stoev
    Keymaster

    Hi Naga,

    To change the column’s text, you can use the ‘setcolumnproperty’ method.

    Example:

    $("#jqxgrid").jqxGrid('setcolumnproperty', 'firstname', 'text', 'New Text');

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    technonaga
    Member

    Hi Peter,

    Once again very thank you for your quick response. i put your sample code in my project. But, it was not work. The old text value was display in grid column text. If you don’t mine, will you send me the brief code sample or any sample code for “setcolumnproperty” using in jqxgrid.

    And, The following code was used in my project,

    var dataAdapter = new $.jqx.dataAdapter(source);

    $(“#jqxgrid”).jqxGrid({
    source: dataAdapter,
    width: 300,
    height: 300,
    sortable: true,
    pageable: true,
    filterable: true,
    sortable: true,
    columnsresize: true,
    ready: function () {
    addfilter();
    },
    autoshowfiltericon: true,
    theme: ”,
    columns: [
    { text: ‘FirstName’, datafield: ‘Column12’, width: 50 },
    { text: ‘LastName’, datafield: ‘Column13’, width: 50 },
    { text: ‘Contact Type’, datafield: ‘Column5’, width: 50 },
    { text: ‘Contact Status’, datafield: ‘Column7’, width: 50 },
    { text: ‘Address’, datafield: ‘Column9’, width: 50 },
    { text: ‘Email’, datafield: ‘Column10’, width: 100 },
    { text: ‘Phone’, datafield: ‘Column11’, width: 100 }
    ]
    });

    $(“#jqxgrid”).jqxGrid(‘setcolumnproperty’, ‘firstname’, ‘text’, ‘New Text’);

    Received Output

    FirstName | LastName | Contact Type | Contact Status

    Excepted Output

    New Text | LastName | Contact Type | Contact Status

    please correct the mistakes in my code and also mention it. Thats only possible to learn & correct my mistakes.

    Thanks & Regards,
    Naga


    technonaga
    Member

    Hi Peter,

    Sorry for in convince, i searched the “setcolumnproperty” keyword in internet. i got the one simple code. I tried the code, the issue was fixed :).

    Actually your code is right. but , i didn’t mention the code correct place thats the problem. Now , it was fixed.

    Thanks & Regards,
    Naga

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.