Datatable Render Completed Event

1,117 views
Skip to first unread message

TMP

unread,
Mar 23, 2016, 6:15:36 PM3/23/16
to yui-support

Hello, I'm adding a status dialog using blockUI to my data table when it gets loaded initially and with each page navigate.  The code below works for our version of the YUI3 datatable that uses gallery-paginator-view with server side pagination. However, i'm having trouble getting the 'dataChange' event to be triggered when the datatable has finished rendering itself using a more basic client-side pagination of YUI3. I'm using YUI3 version 3.11.0.

Does anyone know what event gets fired when the datatable finishes rendering? I believe this part of the code is not being triggered with the default, client-side pagination.

    table.after('dataChange', function() {
    jqHideWaitPanelElement(sasummaryBlockId);
    });


Thanks.

Tri


Code sniplet
-------------------
........

// Paginator

function updatePaginator(
/* object */ state)
{
this.setPage(state.page, true);
this.setRowsPerPage(state.rowsPerPage, true);
sendRequest();
}

var pg = new Y.Paginator(
{
totalRecords: 100,
rowsPerPage: 100,
template: '{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} <span class="rpp">Rows per page:</span> {RowsPerPageDropdown}',
rowsPerPageOptions:    [25,100,500],
firstPageLinkLabel:    '|&lt;',
previousPageLinkLabel: '&lt;',
nextPageLinkLabel:     '&gt;',
lastPageLinkLabel:     '&gt;|'
});
pg.on('changeRequest', updatePaginator);
pg.render('#pg');

ds.on('response', function(e)
{
pg.setTotalRecords(e.response.meta.totalRecords, true);
pg.render();
});


var table = new Y.DataTable({
columns: cols,
data: data,

    // "selection" config stuff begins here ...
        highlightMode: 'row',
        selectionMulti: false,
scrollable: 'y',
width: document.body.clientWidth-25+'px'
});

table.plug(Y.Plugin.DataTableDataSource, {datasource: ds});

table.render('#table');
sendRequest();

    var sasummaryBlockId = 'table';
    pg.after('pageChange', function (e) {
    jqShowWaitPanelElement(sasummaryBlockId);
    });

    table.after('dataChange', function() {
    jqHideWaitPanelElement(sasummaryBlockId);
    });

jqShowWaitPanelElement(sasummaryBlockId);



Paolo Nesti Poggi

unread,
Mar 24, 2016, 6:58:53 AM3/24/16
to yui-s...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "yui-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yui-support...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TMP

unread,
Mar 24, 2016, 12:29:50 PM3/24/16
to yui-support

Paolo, thanks for the response. That seems to work. Here is the code that i use. I also had to move my 'jqShowWaitPanelElement(sasummaryBlockId);' call to before where the YUI table was instantiated. It worked well after that. 

    table.after('render', function() {
    jqHideWaitPanelElement(sasummaryBlockId);
    });
 

Tri
Reply all
Reply to author
Forward
0 new messages