jQWidgets Forums

jQuery UI Widgets Forums Grid asp.net filtering, paging and ordering

This topic contains 2 replies, has 1 voice, and was last updated by  realtime 10 years, 11 months ago.

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

  • realtime
    Participant

    I´m trying to make a grid with Sorting, Paging and Filtering in ASP.NET and SQL.
    i´m following this example http://www.jqwidgets.com/jquery-widgets-documentation/documentation/asp.net-integration/asp.net-grid-paging-sorting-filtering.htm

    It doesn´t work for me.

    I see the data properly formated in beforeprocessing event but when i review the args.data in the rendergridrows property the array is empty. I don´t know how to fix the code. Can anyone help me?.

    This is my code:

    $(document).ready(function () {

    function buildQueryString(data) {
    var str = ”;
    for (var prop in data) {
    if (data.hasOwnProperty(prop)) {
    str += prop + ‘=’ + data[prop] + ‘&’;
    }
    }
    return str.substr(0, str.length – 1);
    }

    var formatedData = ”;
    var totalrecords = 0;
    var theme = ‘energyblue’;

    //Getting the source data with ajax GET request
    var source = {
    datatype: “json”,
    datafields: [
    { name: ‘Cic’ }
    ],
    sort: function () {
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘sort’);
    },
    filter: function () {
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’, ‘filter’);
    },
    beforeprocessing: function (data) {
    var returnData = {};
    data = data.d;
    totalrecords = data.count;
    returnData.totalrecords = data.count;
    returnData.records = data.data;
    return returnData; //At this point i see the data with 16 records well formated.
    },
    type: ‘get’,
    sortcolumn: ‘Cic’,
    sortdirection: ‘asc’,
    formatdata: function (data) {
    data.pagenum = data.pagenum || 0;
    data.pagesize = data.pagesize || 10;
    data.sortdatafield = data.sortdatafield || ‘Cic’;
    data.sortorder = data.sortorder || ‘asc’;
    data.filterscount = data.filterscount || 0;
    formatedData = buildQueryString(data);
    return formatedData;
    },
    url: ‘rubenovale.aspx/GetCustomers’
    };

    var dataAdapter = new $.jqx.dataAdapter(source, {
    contentType: ‘application/json; charset=utf-8’,
    loadError: function (xhr, status, error) {
    alert(error);
    }
    });

    $(“#jqxgrid”).jqxGrid({
    source: dataAdapter,
    theme: theme,
    pageable: true,
    autoheight: true,
    virtualmode: true,
    sorttogglestates: 1,
    filterable: true,
    sortable: true,
    rendergridrows: function (args) {
    return args.data; //At this point i dont have data
    },

    columns: [
    { text: ‘Cic’, dataField: ‘Cic’, width: 250 }

    ]
    });

    });


    realtime
    Participant

    The data adapter when rendergridrows try to return the data has the totalrecords property ok with 16 records, the records property with 10 elements but these elements are empty and the recordids property with 10 elements but here i see the data ok.


    realtime
    Participant

    oh my god!! i got the solution. The fuc… name of the field was incorrect. 2 days with this 🙁

    sorry guys.

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

You must be logged in to reply to this topic.