Skip navigation
Currently Being Moderated

Is it possible to delegate the display of a datagrid in a worker ?

Jul 15, 2013 12:38 AM

Tags: #spark #datagrid #workers

Hi everyone,

 

I'm currently working on a process that receives "real-time" information using sockets. These information are displayed within a spark datagrid.

 

The informations received can have several formats such as :

* Add this line to the grid,

* Update this line of the grid

* Remove this line of the gris.

 

But the problem is as the data are arriving continuously, the datagrid can't refresh, and the application frezees. So I wonder how I could put the datagrid inside a worker, in order to have a smooth application while receiving data.

 

 

Thanks a lot for your help.

 
Replies
  • Currently Being Moderated
    Jul 15, 2013 1:08 AM   in reply to bw_syl

    If the data is arriving so fast, how do you expect the user to evaluate it, regardless of how it is displayed?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 1:50 AM   in reply to bw_syl

    Maybe you can filter the changes ( are there duplicates in the data )?

     

    Another strategy is to batch the changes. Make a change no more often than say once every second or couple of seconds, or..  If you have a queue of 100 changes, do them all together.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 4:04 AM   in reply to bw_syl

    If you know what the object type is, you can cast it. If not you might wrap it inside another object that includes the object class name.

     

    I haven't used workers, so I have no other suggestions.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 6:48 AM   in reply to bw_syl

    Your case is rather unusual, to say the least, and bordering on the absurd.

     

    You have 600 lines present, but they change multiple times every second. It sounds a bit like watching the windows process manager.

     

    You can't read 600 lines at once and you can't scroll reliably either because the underlying data that you are seeing is changing all the time.

     

    Probably what I might do is only have a grid that is as large as can fit on your page. Make the underlying data source only have as many rows as can be seen. Ditch the scrollbars for your grid.

     

    Have a separate scrollbar to page content, or use tabs.

     

    Maintain your incoming data manipulations in an Array or Vector. If you have 50 lines in your datagrid, copy 50 entries into a seperate array and use that as the datasource for the datagrid. Change the data in the datasource array according to updates received or paging via the scrollbar/tabs.

     

    This should greatly reduce the load on the datagrid and screen refresh.

     

    Before incorporating it into your app, build a test app and test the performance.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 15, 2013 6:57 AM   in reply to bw_syl
     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2013 7:40 AM   in reply to bw_syl

    Since the selected lines will change as the content changes, you'll need to remember the key for any selected line, before refreshing. By key, I mean a unique identifier, other than the position in the array.

     

    Remember the selected keys, refresh the display, search for selected keys and select the row again.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 16, 2013 11:14 AM   in reply to bw_syl

    Excellent - good job!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points