EasyUI Forum
April 29, 2024, 02:24:29 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: EasyUI and Socket.IO  (Read 8835 times)
ahybits
Newbie
*
Posts: 26


View Profile
« on: January 25, 2016, 05:57:42 AM »

HI,

I was wondering if I can get some ideas on how to accomplish the following:

I have a grid with 5 columns and around 30 rows.  I need the last column to be real time.  As a workaround, i have been using setInterval, but that loads the whole data (of course I can create another function to get just the data for the last column and update each row, but was hoping to find a way to use Socket.IO instead

How can i leverage realtime data with the datagrid?
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: January 25, 2016, 08:23:12 PM »

You can call 'updateRow' method to update datagrid rows when receiving the data from the server.
Code:
socket.on('customevent', function(data){
// parse data;
$('#dg').datagrid('updateRow', {
...
})
})
Logged
ahybits
Newbie
*
Posts: 26


View Profile
« Reply #2 on: January 26, 2016, 12:43:22 PM »

Do you think I should still use the url: parameter for the datagrid to get the initial data and then jsut run the socket.on for updaterow
or
load all data via socket and then run updateRow as needed ?
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!