How to propagate sorting if nest tables as child rows (or other way to show/sort nested data)?

How to propagate sorting if nest tables as child rows (or other way to show/sort nested data)?

marinashestuninamarinashestunina Posts: 2Questions: 1Answers: 0

Hello!
The question is if it possible to create a tree-like table (data is recursive, n-levels deep). I currently created one: http://jsfiddle.net/aS7qu/26/
Clicking the button in the row will expand/collapse children.

My problem is sorting. On sort I want to sort all child levels together with parents. I'm trying to propagate the order for child table on drawCallback (probably wrong) and observe that this handler executes before the actual draw event is triggered (but the child rows seem to be shown only AFTER draw is triggered).

this code in the library is a responsible for it:
function _fnCallbackFire(settings, callbackArr, event, args) {
var ret = [];

        if (callbackArr) {
            ret = $.map(settings[callbackArr].slice().reverse(), function (val, i) {
                return val.fn.apply(settings.oInstance, args);
            });
        }

        if (event !== null) {
            $(settings.nTable).trigger(event + '.dt', args);
        }

        return ret;
    }

I see that my drawCalback executes before the event trigger, however I expect it to execute after the 'draw' event is triggered (as name says callback). Out of curiosity I've tried to change the lines vise verse, e.g
function _fnCallbackFire(settings, callbackArr, event, args) {
var ret = [];
if (event !== null) {
$(settings.nTable).trigger(event + '.dt', args);
}
if (callbackArr) {
ret = $.map(settings[callbackArr].slice().reverse(), function (val, i) {
return val.fn.apply(settings.oInstance, args);
});
}

        return ret;
    }

and it works.

Can you please point me to the right direction to solve the problem? Any help would be appreciated!

Thanks,
Marina

Answers

This discussion has been closed.