sorting directories/files in one table
sorting directories/files in one table
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]
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]
This discussion has been closed.
Replies
how can I set that second function will be started only when first function was finished?