jQuery UI Widgets Forums Grid Get Filtered Datas in dataAdapter in JQXGrid

This topic contains 1 reply, has 1 voice, and was last updated by  vinu 7 years, 4 months ago.

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

  • vinu
    Participant

    Hi,
    I have used JQXGrid in my application. In Initial Load, datas are retrieved from server and loaded into dataAdapter and that dataAdapter is used as source for grid. When I filter any column in the grid i need to have those filtered datas alone in the dataAdapter. Could anyone please help me. Any help is appreciated.

    function loadGrid(data, ref, undo) {
    //debugger;

    try {
    var source =
    {
    datatype: “json”,
    datafields:
    [
    { name: ‘ProductionResource’, type: ‘string’ },
    { name: ‘Series’, type: ‘string’ },
    { name: ‘ItemStatus’, type: ‘string’ },
    { name: ‘FutureStatus’, type: ‘string’ },
    { name: ‘Abc1Code’, type: ‘string’ },
    { name: ‘ItemNumber’, type: ‘string’ },
    { name: ‘FirmDemands’, type: ‘number’ },
    { name: ‘NetForecast’, type: ‘number’ },
    { name: ‘PromotionalLift’, type: ‘number’ },
    { name: ‘TotalReceipts’, type: ‘number’ },
    { name: ‘ItemQuantity’, type: ‘number’ },
    ],
    localdata: data
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $(“#mainData”).jqxGrid(
    {
    width: ‘99.5%’,
    pageable: false,
    height: ‘100%’,
    rowsheight: 30,
    altrows: true,
    source: dataAdapter,
    groupable: true,
    groups: [‘Series’],
    showgroupsheader: false,
    groupsrenderer: function (defaultText, group, state, params) {
    //return “<div style=’margin: 5px;’>” + group + “</div>”;
    return “<div style=’margin: 5px;’>” + ” + “</div>”;
    },
    groupsexpandedbydefault: true,
    sortable: false,
    filterable: true,
    //filtermode: ‘excel’,
    columnsresize: true,
    columnsreorder: true,
    editable: true,
    selectionmode: ‘multiplecellsadvanced’,
    //autoshowfiltericon: false,
    showfilterrow: false,
    columnmenuopening: function (menu, datafield, height) {
    var column = $(“#mainData”).jqxGrid(‘getcolumn’, datafield);
    if (column.filtertype === “custom”) {
    menu.height(1000);
    setTimeout(function () {
    menu.find(‘input’).focus();
    }, 25);
    }
    else menu.height(height);
    },
    columns: [
    { text: ‘Production Resource’, datafield: ‘ProductionResource’, width: ‘8.5%’, editable: false, groupable: false },
    { text: ‘Series’, datafield: ‘Series’, width: ‘8.5%’, editable: false, groupable: true },
    { text: ‘Item Status’, datafield: ‘ItemStatus’, width: ‘8.5%’, editable: false, groupable: false },
    { text: ‘Future Status’, datafield: ‘FutureStatus’, width: ‘6%’, editable: false, groupable: false },
    { text: ‘ABC 1 (Tiers)’, datafield: ‘Abc1Code’, width: ‘5%’, editable: false, groupable: false },
    { text: ‘Item #’, datafield: ‘ItemNumber’, width: ‘8.5%’, editable: false, groupable: false },
    { text: ‘Firm Demands’, datafield: ‘FirmDemands’, width: ‘6%’, editable: false, groupable: false },
    { text: ‘Net Forecast’, datafield: ‘NetForecast’, width: ‘6%’, editable: false, groupable: false },
    { text: ‘Promotional Lift Qty’, datafield: ‘PromotionalLift’, width: ‘8%’, editable: false, groupable: false },
    { text: ‘Total Receipts’, datafield: ‘TotalReceipts’, width: ‘6.5%’, editable: false, groupable: false },
    } catch (e) {
    alert(e.message);
    }

    • This topic was modified 7 years, 4 months ago by  Peter Stoev. Reason: Moved to Grid Forum

    vinu
    Participant

    Hi All,
    I have achieved it by using the following piece of codes.

    var rows = $(“#mainData”).jqxGrid(‘getrows’);
    var dataAdapter = new $.jqx.dataAdapter(source);
    dataAdapter.records = rows;

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

You must be logged in to reply to this topic.