jQuery UI Widgets › Forums › Grid › Filtering numeric type

Tagged: 

This topic contains 5 replies, has 2 voices, and was last updated by  Peter Stoev 14 years ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Filtering numeric type #8244

    mpfromindia
    Member

    I have a grid that is filled by jSON results. One of the column could be numeric or text based on user selection before populating the grid. Have imported jqxgrid.filter.js file, also specifying filtertype:’number’ .It’s giving me error in jqxgrid.filter.js file. I am using 2.4.2.

    Filtering numeric type #8246

    Peter Stoev
    Keymaster

    Hi mpfromindia,

    Here’s a sample which demonstrates how to set a numeric filter:filterrow.htm.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Filtering numeric type #8247

    mpfromindia
    Member

    I used that as an example for my development, not sure if I am missing something .Let me try to simulate what I am trying to do. Say for ex: you have a column called ‘City’ in your grid. You also have Radiobutton say ‘City Name’ or ‘Zip Code’. If you select city name grid column would be of type string & numeric in case user selected by zip code. I need to change filter type based on user selection. The one for string is working fine but not the one for numeric. I want the filter row column to be textbox & not select list with options like ‘null,not null, greater than…’

    Filtering numeric type #8248

    Peter Stoev
    Keymaster

    Hi mpfromindia,

    I don’t know what could be the issue on your side. Please, send us a small sample to support@jqwidgets.com which demonstrates the erroneous behavior.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Filtering numeric type #8249

    mpfromindia
    Member

    Hello Peter,

    Trying to paste some code here, let me know if it doesn’t make any sense to you. BTW, I am using MVC3.

    var codeTypeCol = ‘City Name’; // sets column name based on user selection
    if(type==’z’ || type==’Z’) // type is a variable that reads user selection ,if he/she wants it by Zip Code or by City Name
    codeTypeCol=’Zip Code’;

    $.ajax({
    datatype: “json”,
    url: “/websitename/controllername/FindCityofEmployees”, //url
    data: { state: state, codeType: type }, // parameter to controller action
    beforeSend: function (result) {
    $(‘#jqxgrid’).toggle(); // hide grid
    $(‘.processbar’).toggle(); //show processbar
    },
    success: function (result) {
    $(‘#jqxgrid’).toggle(); //show grid once we have results
    $(‘.processbar’).toggle(); // hide processbar

    var source = {
    datatype: “json”,
    datafields: [{ name: ‘FName’ }, { name: ‘LName’ },
    { name: ‘City’ }],
    localdata: result
    };

    var dataAdapter = new $.jqx.dataAdapter(source, { downloadComplete: function (data, status, xhr) { }, loadComplete: function (data) { }, loadError: function (xhr, status, error) { } });

    $(“#jqxgrid”).jqxGrid({

    width: 930,
    showfilterrow: true,
    filterable: true,
    selectionmode: ‘singlecell’,
    source: dataAdapter,
    theme: ‘ui-redmond’,

    columns: [{ text: ”, datafield: ‘City’, width: 60, cellsrenderer: chkboxrenderer }, { text: codeTypeCol, datafield: ‘City’, width: 150},
    { text: ‘First Name’, datafield: ‘FName’, width: 350 },
    { text: ‘Last Name’, datafield: ‘LName’,width: 300}]
    });
    }
    });

    var chkboxrenderer = function (row, datafield, value) {
    ‘input type=”checkbox” name=”chkCity” id=”chkCity” value=”‘ + value + ‘” />’;
    Thanks!

    Filtering numeric type #8275

    Peter Stoev
    Keymaster

    Hi mpfromindia,

    Unfortunately, the posted code does not help. I still cannot reproduce the issue. You also reported that filtertype does not work for numeric data, but I don’t see in your code where you set the filtertype. I would like to request for a sample again. Please, send us something small with mock data to support@jqwidgets.com which demonstrates the erroneous behavior. That will allow us to test and debug your application’s scenario.

    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.