jQWidgets Forums

jQuery UI Widgets Forums Grid Field fiter "Grid"

This topic contains 10 replies, has 3 voices, and was last updated by  ekaperintis 12 years, 7 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • Field fiter "Grid" #6588

    Rodrigo
    Participant

    Hi all,

    I’m have just started evaluating jqwidgets for a project and so far I’m loving it! however, I have just come stuck when trying to filter a grid from an input field. The filter seems to be grabbing the right data from the database, but I not sure how to refresh my grid using code below:

    $(document).ready(function () {

    var theme = ”;

    var url = “{/literal}{$BASE_HREF}{literal}/test/users”;
    var parentsLength = $(“#jqxWidget”).parents().length;
    if (parentsLength > 3) {
    url = ‘{/literal}{$BASE_HREF}{literal}/test/users’;
    }

    // prepare the data
    var source =
    {
    datatype: “json”,
    datafields: [
    { name: ‘branchcode’ },
    { name: ‘branchname’ },
    { name: ‘fname’},
    { name: ‘sname’}
    ],
    id: ‘id’,
    url: url,
    root: ‘data’
    };

    //var dataAdapter = new $.jqx.dataAdapter(source);
    var dataAdapter = new $.jqx.dataAdapter(source,
    {

    formatData: function (data) {
    data.name_startsWith = $(“#small-input”).val();
    return data;
    }
    });

    $(“#jqxgrid”).jqxGrid(
    {
    width: 670,
    source: dataAdapter,
    theme: theme,
    columnsresize: true,
    columns: [
    { text: ‘Branch Code’, dataField: ‘branchcode’, width: 100 },
    { text: ‘Branch Name’, dataField: ‘branchname’, width: 340 },
    { text: ‘First Name’, dataField: ‘fname’, width: 100 },
    { text: ‘Surname’, dataField: ‘sname’, width: 100 }

    ]
    });

    var me = this;
    $(“#small-input”).bind(‘keydown’, function (event) {
    if ($(“#small-input”).val().length >= 2) {
    if (me.timer) clearTimeout(me.timer);
    me.timer = setTimeout(function () {
    dataAdapter.dataBind();

    }, 300);
    }
    });

    });

    Field fiter "Grid" #6599

    Peter Stoev
    Keymaster

    The Grid’s ‘updatebounddata’ method refreshes the Grid’s data.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Field fiter "Grid" #6684

    Rodrigo
    Participant

    Hi Peter,

    That’s great thank you!… just one more thing 🙁 where on the code would i place it? i’ve tried and keep on getting a no object for jqgrid.

    Rodrigo

    Field fiter "Grid" #6688

    Peter Stoev
    Keymaster

    Hi Rodrigo,

    You can use the ‘updatebounddata’ method instead of dataAdapter.dataBind();

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Field fiter "Grid" #6862

    Rodrigo
    Participant

    Hi Peter,

    I appreciate your help and don’t mean to be a pain, but I still can’t get the grid to reload the filtered data by doing the sample below. Unfortunately there aren’t any examples of such.

    // FILTER
    var me = this;
    $(“#small-input”).bind(‘keydown’, function (event) {
    if ($(“#small-input”).val().length >= 2) {

    if (me.timer) clearTimeout(me.timer);
    me.timer = setTimeout(function () {

    //dataAdapter.dataBind();
    $(‘#jqxgrid’).jqxGrid(‘updatebounddata’);

    }, 300);

    }

    });

    I get the following error on my console:

    Uncaught TypeError: Object # has no method ‘toArray’ jqxcore.js:7
    a.jqx.invoke jqxcore.js:7
    a.jqx.jqxWidgetProxy jqxcore.js:7
    a.jqx.jqxWidget.a.fn.(anonymous function) jqxcore.js:7
    o.extend.each jquery-1.3.2.min.js:12
    o.fn.o.each jquery-1.3.2.min.js:12
    a.jqx.jqxWidget.a.fn.(anonymous function) jqxcore.js:7
    (anonymous function)

    Field fiter "Grid" #6868

    Rodrigo
    Participant

    I have also tried using the “filter api” and not having any luck either.

    Essentially all i’d like to do is to have a “text/input” field with a “search/button” next to it. On click of button retrieve the data via json/php and refresh the grid.

    Rodrigo

    Field fiter "Grid" #6869

    Peter Stoev
    Keymaster

    Do you use jQuery 1.7.2? We support versions of jQuery 1.6+. From your code, I think that you use jQuery 1.3.2 which is not supported.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Field fiter "Grid" #6870

    Rodrigo
    Participant

    AH HA!!!! Thanks Peter, really appreciate your assistance/patience 🙂 downloaded 1.7.2 and looking better already!

    Have a great one!
    Rodrigo

    Field fiter "Grid" #11372

    ekaperintis
    Participant

    AH HA!!!! Thanks Peter, really appreciate your assistance/patience 🙂 downloaded 1.7.2 and looking better already!

    Can you to code programs that are run well ….

    Thanks …

    Field fiter "Grid" #11388

    Peter Stoev
    Keymaster

    Hi ekaperintis,

    We provide only UI tools. We currently do not offer other programming services.

    Best Wishes,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Field fiter "Grid" #11391

    ekaperintis
    Participant

    Hi Peter Stoev

    I’m sorry, did not mean to offend you

    I’m sorry if the language used is not understood, I’m from Indonesia and not too advanced english

    thank you

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

You must be logged in to reply to this topic.