sorting directories/files in one table

sorting directories/files in one table

vtshnicavtshnica Posts: 2Questions: 0Answers: 0
edited June 2011 in General
I have list of directories and files in one table.
Data comes from json files.
First I run function for directories, then for files.
But sometimes in datatable files shown first.
What should I do to show directories always on top?

[code]
$.getJSON(subdirs, function(data) {
$.each(data, function(key) {
$('#example').dataTable().fnAddData( [
'',
''+data[key].title+'',
'',
''
] );
});
});

$.getJSON(filelist, function(data) {
$.each(data, function(key) {
$('#example').dataTable().fnAddData( [
'',
data[key].name,
data[key].size,
data[key].date
] );
});
});
[/code]

Replies

  • vtshnicavtshnica Posts: 2Questions: 0Answers: 0
    may be use timeout or delay?
    how can I set that second function will be started only when first function was finished?
This discussion has been closed.