jQWidgets Forums

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts

  • stanleyjebadurai
    Participant

    Hi ,

    I have a constrain ,for one column I need String filter like AND , OR , contains and another column I need excel filter . Kindly guide me how to proceed.

    If I use filtermode: ‘excel’ all the column appended by checkbox filter here I’m not able to override one some column to String filter.

    $(document).ready(function() {
    var data = generatedata(500);
    var source =
    {
    localdata: data,
    datafields:
    [
    {name: ‘name’, type: ‘string’},
    {name: ‘productname’, type: ‘string’},
    {name: ‘available’, type: ‘bool’},
    {name: ‘date’, type: ‘date’},
    {name: ‘quantity’, type: ‘number’}
    ],
    datatype: “array”
    };

    var addfilter = function() {
    // create a filter group for the FirstName column.
    var fnameFilterGroup = new $.jqx.filter();
    fnameFilterGroup.operator = ‘or’;
    // operator between the filters in the filter group. 1 is for OR. 0 is for AND.
    var filter_or_operator = 1;
    // create a string filter with ‘contains’ condition.
    var filtervalue = ‘la’;
    var filtercondition = ‘contains’;
    var fnameFilter1 = fnameFilterGroup.createfilter(‘stringfilter’, filtervalue, filtercondition);
    // create second filter.
    filtervalue = ‘la’;
    filtercondition = ‘starts_with’;
    var fnameFilter2 = fnameFilterGroup.createfilter(‘stringfilter’, filtervalue, filtercondition);
    // add the filters to the filter group.
    fnameFilterGroup.addfilter(filter_or_operator, fnameFilter1);
    fnameFilterGroup.addfilter(filter_or_operator, fnameFilter2);
    // add the filter group to the ‘firstname’ column in the Grid.
    $(“#jqxgrid”).jqxGrid(‘addfilter’, ‘name’, fnameFilterGroup);

    //

    // apply the filters.
    $(“#jqxgrid”).jqxGrid(‘applyfilters’);
    }

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

    $(“#jqxgrid”).jqxGrid(
    {
    width: 685,
    source: dataAdapter,
    ready: function() {
    addfilter();
    },
    autoshowfiltericon: true,
    filtermode: ‘excel’,
    pagesize: 20,
    pagesizeoptions: [’20’, ’50’, ‘100’],
    //showfilterrow: true,
    filterable: true,
    sortable: true,
    selectionmode: ‘multiplecellsextended’,
    columns: [
    {text: ‘Name’, filtertype: ‘textbox’, datafield: ‘name’, width: 115},
    {
    text: ‘Product’, filtertype: ‘checkedlist’, datafield: ‘productname’, width: 220
    },
    {text: ‘Available’, datafield: ‘available’, columntype: ‘checkbox’, filtertype: ‘bool’, width: 67},
    {text: ‘Ship Date’, datafield: ‘date’, filtertype: ‘date’, width: 210, cellsalign: ‘right’, cellsformat: ‘d’},
    {text: ‘Qty.’, datafield: ‘quantity’, filtertype: ‘excel’, cellsformat: ‘c2’ ,cellsalign: ‘right’}
    ]
    });

    });

    Thanks in advance

    Regards,
    Stanley

Viewing 1 post (of 1 total)