Datatable - dealing with insert/update of lines

jQuery UI Widgets
Post Reply
averri
Posts: 136
Joined: 07 Sep 2009, 15:51
Location: Brazil

08 Feb 2014, 17:37

I have a datatable which is updated every second. This table gets very big, with thousands of lines. So, I can't update the entire table every second. New information must be inserted, but others must be updated.

How to handle this scenario using PrimeUI datatable?

rubus
Posts: 517
Joined: 01 Oct 2010, 09:41
Location: Belgium

09 Feb 2014, 11:34

Hi,

Is it realistic to have so many rows on the screen? Maybe with pagination it is more manageable.

This is what I have added to datatable to be able to refresh the shown data.

Code: Select all

        _rerender: function(data) {
            this.data = data;
            this._renderData();
        },

        refresh: function() {
            if(this.options.datasource) {
                if($.type(this.options.datasource) === 'function') {
                    if(!this.options.lazy) {

                        this.options.datasource.call(this, this._rerender);

                    }

                }
            }
        }

regards
Rudy
PrimeFaces version 3.5, Tomcat 7, Mojarra 2.1.13
PrimeFaces version 4.0, Glassfish 4.0
PrimeFaces version 5.0, WLS 12.1.2
If you haven't read the forum rules read them now : viewtopic.php?f=3&t=1194

averri
Posts: 136
Joined: 07 Sep 2009, 15:51
Location: Brazil

09 Feb 2014, 17:21

Hi Rudy,

thank you for your attention.

I don't need to have too many rows in the screen, furthermore the browser gets too slow with so many data. I need to use pagination. The table is rendered in the reverse order, the 1st line is always the most recent information.

I am thinking in doing the following:

1) After receiving the JSON array with data, iterate over it and check if actual data is already inserted in the table. It could be done using the GUID of each object.

2) If the atcual data doesn't exist, insert it in the first line, otherwise, update it in the corresponding line position.

AngularJS will do his job and update the table accordingly.

I could use a Map to index each GUID in order to speed up the lookup: {guid->array_index} , but I need to know if the sort function changes the underlying table array.

Regards,
Alexandre

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest