jQWidgets Forums

jQuery UI Widgets Forums Grid Grid Refresh without Reloading Parent Window

This topic contains 8 replies, has 3 voices, and was last updated by  dima72 10 years, 1 month ago.

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

  • thommy
    Member

    Team,

    I have a window with input boxes to capture the data from a user that is saved to the database as soon as the ‘Save’ button is clicked.
    Questions:
    1. How can I reflect the new data added by the user in the data grid below without having to refresh the parent window Just after the ‘Save’ button is hit?
    2. How can I reflect the real time data from a data source on the grid without refreshing the grid window. Is it possible to use a timer, say at the interval of 5 milliseconds to fetch the updates and show on the grid instantly? If yes, please show me the sample code for it.

    Thanks


    Peter Stoev
    Keymaster

    Hi thommy,

    The Grid’s “updatebounddata” method performs a new data bind and updates the Grid data. If your jqxDataAdapter plug-in is bound to your server, this means that when you call “updatebounddata” a new Ajax request for new data would be sent and once received the Grid will update itself.

    To call “updatebounddata”, use:

    $("#gridID").jqxGrid('updatebounddata');

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    thommy
    Member

    Peter,

    Thanks for the response and it’s working. However you haven’t responded to my second question:
    2. How can I reflect the real time data from a data source on the grid without refreshing the grid window. Is it possible to use a timer, say at the interval of 5 milliseconds to fetch the updates and show on the grid instantly? If yes, please show me the sample code for it.

    Regards


    Peter Stoev
    Keymaster

    Hi thommy,

    It is possible to call “updatebounddata” within setInterval callback function. However, I suggest you to check whether you scroll or not at the same time before calling that method – var scrolling = $(‘#jqxGrid’).jqxGrid(‘scrolling’); and call it with “cells” parameter as shown here: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/refreshdata.htm?arctic

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    dima72
    Participant

    Dear Peter
    can you show extended example of ‘scrolling’ property
    `var scrolling = $(“#jqxgrid”).jqxGrid(“scrolling”);
    if( scrolling == false )
    {
    $(“#jqxgrid”).jqxGrid(‘updatebounddata’);
    }`

    does not really work

    thanks,


    Peter Stoev
    Keymaster

    Hi dima72,

    var scrolling = $(‘#jqxGrid’).jqxGrid(‘scrolling’); returns Boolean value which determines whether the user scrolls or not. This works pretty fine. “updatebounddata” re-binds the Grid using the same data source i.e performs dataAdapter.dataBind() which works fine, too.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    dima72
    Participant

    Dear Peter,
    in documentation

    there is no ‘scrolling’ property described,
    and it therefore returns always [Object] but not boolean regardless of grid scrollmode

    i’m looking to disable $(“#jqxgrid”).jqxGrid(‘updatebounddata’) when there is any user mouse activity above the grid,

    please help,
    thanks


    Peter Stoev
    Keymaster

    Hi dima72,

    Ok, it returns { vertical: Boolean value, horizontal: Boolean value}; You can check btw with your Debugger. But you may also not use it as it’s internal API and find out other approach for your task.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    dima72
    Participant

    I have checked in Debugger = vertical and horizontal properties are always returning false
    regardless scrolling in the grid is happening.

               var scrolling = $("#jqxgrid").jqxGrid('scrolling');
               if( scrolling.vertical == false )
               {
                 $("#jqxgrid").jqxGrid('updatebounddata');
               }

    this code does refresh in the grid all the time regardless scrolling vertical with mouse wheel.

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

You must be logged in to reply to this topic.