Add new internal events on data model layer call _fnCallbackFire inside _fnAddData and _fnClearTable

Add new internal events on data model layer call _fnCallbackFire inside _fnAddData and _fnClearTable

boulandbouland Posts: 1Questions: 0Answers: 0

Hi,

Adding this events will give access to the data models to plugins developpers.

    function _fnClearTable( settings )
    {
        settings.aoData.length = 0;
        settings.aiDisplayMaster.length = 0;
        settings.aiDisplay.length = 0;
        _fnCallbackFire( settings, 'aoTableClearedCallback', null, [settings] );
    }

and

function _fnAddData ( oSettings, aDataIn, nTr, anTds )
    {
        /* Create the object for storing information about this new row */
        var iRow = oSettings.aoData.length;
        var oData = $.extend( true, {}, DataTable.models.oRow, {
            src: nTr ? 'dom' : 'data'
        } );
    
        oData._aData = aDataIn;
        oSettings.aoData.push( oData );
    
        _fnCallbackFire( oSettings, 'aoDataAddedCallback', null, [oSettings, oData, iRow] );

Usage :
A grouping plugin which extends models like that :

DataTable.models.oGroup
DataTable.models.oSettings.aoGroups
DataTable.models.oRow._iGroup

A group compute some datas from its children rows.

Rgds,
Simon

Replies

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Hi Simon,

    I'm actively looking into this for v1.11 - also for row updates and deletes as well. My biggest concern at the moment it the impact on performance. It isn't so bad if you use native Javascript arrays / callbacks like that, but jQuery events add some serious overhead. I've yet to decide how to handle that.

    Allan

This discussion has been closed.