jQuery UI Widgets Forums Grid Version 2.8

This topic contains 8 replies, has 4 voices, and was last updated by  Peter Stoev 9 years, 2 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Version 2.8 Posts
  • Version 2.8 #18052

    SylvainD
    Member

    Hello,

    with this new version, it seems that I haven’t the possibility of using 2 times the same datafield in a grid.

    Before (version 2.7) my code was :

    $("#jxgGridOrder").jqxGrid(
    {
    source: dataAdapter,
    autoheight: true,
    columns: [
    { text: 'Id', datafield: 'Id', width: 100 },
    { text: 'Name', datafield: 'Name', width: 150 },
    { text: 'Date de Création', datafield: 'CreationDate', width: 250 },
    {
    text: '', datafield: 'Id', width: 20, cellsalign: 'right',
    cellsrenderer:
    function (row, columnfield, value, defaulthtml, columnproperties) {
    return '<div style="text-align:center"><a href=\'javascript:CancelOrder(' + value + ')\'><img src=\"../../Content/images/glyphicons/png/glyphicons_207_remove_2.png\" height=15 width=15/></a></div>';
    }
    }
    ]
    });

    Now I have an error messge :
    Invalid column ‘datafield’ setting. jqxGrid’s columns should be initialized with unique data fields.

    If I remove the second usage of the Id field, everything is fine.
    Is it a normal behavior with the new version ?

    Thanks
    Sylvain

    Version 2.8 #18053

    SylvainD
    Member

    Oups sorry,this post is for the grid section ! I though I was there.

    Version 2.8 #18055

    Dimitar
    Participant

    Hello SylvainD,

    Yes, with version 2.8, column datafields cannot be the same.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Version 2.8 #18057

    SylvainD
    Member

    Ok, so … How should I change to make it work ?

    Thanks
    Sylvain

    Version 2.8 #18058

    SylvainD
    Member

    I used : dataAdapter.records[row][‘datafilename’]

    Is-it the right way to do it ?

    Version 2.8 #18061

    Dimitar
    Participant

    Hi SylvainD,

    You should use datafields with unique names or copy a datafield into another one, e.g.:

                var source =
    {
    localdata: data,
    datatype: "array",
    datafields:
    [
    { name: 'firstname', type: 'string' },
    { name: 'firstnameCopy', type: 'string' },
    { name: 'lastname', type: 'string' },
    { name: 'productname', type: 'string' },
    { name: 'quantity', type: 'number' },
    { name: 'price', type: 'number' }
    ]
    };
    var dataAdapter = new $.jqx.dataAdapter(source,
    {
    beforeLoadComplete: function (records) {
    for (var i = 0; i < records.length; i++) {
    records[i].firstnameCopy = records[i].firstname;
    };
    return records;
    }
    }
    );

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    Version 2.8 #18063

    SylvainD
    Member

    Ok.

    Thanks

    Version 2.8 #75689

    raman1987
    Participant

    This works at client side
    But I am using Server side filtering and sorting
    how can I get the column name in case of server side sorting and filtering

    Version 2.8 #75691

    Peter Stoev
    Keymaster

    Hi raman1987,

    The “getcolumn” method returns the column’s object. Ex: http://jsfiddle.net/jqwidgets/HDz7p/

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.