jQWidgets Forums

jQuery UI Widgets Forums Grid CellsFormat in jqxgrid is not working

Tagged: ,

This topic contains 5 replies, has 3 voices, and was last updated by  Peter Stoev 8 years, 10 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • CellsFormat in jqxgrid is not working #15978

    skambo
    Member

    Cellsformat is not working, Please let me know if I am doing anything wrong.

    Here is my code:

    $(document).ready(function ()
    {
    //Getting the source data with ajax GET request
    source = {
    datatype: "xml",
    datafields: [
    { name: 'CourseName' },
    { name: 'StartDate' },
    { name: 'EndDate' },
    { name: 'StudentName' },
    { name: 'TeacherName' }
    ],
    async: false,
    record: 'Table',
    url: 'ListCourses.aspx/GetCourses'
    };

    var dataAdapter = new $.jqx.dataAdapter(source,{contentType: 'application/json; charset=utf-8'});

    $("#jqxgrid").jqxGrid({
    source: dataAdapter,
    theme: 'classic',
    width: 1024,
    sortable: true,
    pageable: true,
    groupable: true,
    showfilterrow: true,
    filterable: true,
    columns: [
    { text: 'Course Name', dataField: 'CourseName', width: 200 },
    { text: 'Start Date', dataField: 'StartDate', cellsformat: 'D', width: 200 },
    { text: 'End Date', dataField: 'EndDate', cellsformat: 'd', width: 200 },
    { text: 'Student Name', dataField: 'StudentName', width: 200},
    { text: 'Teacher Name', dataField: 'TeacherName', width: 200 }
    ]
    });

    });

    This is the result that I am getting

    Science 1002 2012-12-31T00:00:00-05:00 2013-02-19T00:00:00-05:00 Ajay Rathore First Last

    CellsFormat in jqxgrid is not working #16001

    Peter Stoev
    Keymaster

    Hi skambo,

    You missed to set the “type” field in the datafields array definition. Each datafield should have a “type” field – “string”, “number”, “bool” or “date”.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    skambo
    Member

    Thank You very much Sir. I appreciate your help.

    Row Filters are also not working in date?

    Thanks,
    skambo

    CellsFormat in jqxgrid is not working #16240

    Peter Stoev
    Keymaster

    Hi skambo,

    For filtering, you may take a look at the demos available online. There is a Date column in the Filter Row’s sample.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    damerval
    Participant

    Just as a note, I wanted to point out that neither the documentation nor the demos mention that type must be set for cell formatting to work. The source code featured in the documentation does not feature type fields being set in the columns settings for the grid. This is just intended as feedback – perhaps bringing the documentation up to date would be advisable.
    Thanks


    Peter Stoev
    Keymaster

    Hi damerval,

    The documentation is Up to Date and so are the Demos. “type” is not a column property. It’s a data adapter property.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.