Use "HTML5, Flash export button" function. 1000 rows export is very slow ...
Use "HTML5, Flash export button" function. 1000 rows export is very slow ...
Hello everyone!
I am migrating "C / S" programs in Korea using "DataTables".
I'm using Google Translator to ask a question.
Thank you for your understanding.
I am trying "TEST" hard now ...
Https://datatables.net/extensions/buttons/examples/html5/simple.html
Https://datatables.net/extensions/buttons/examples/flash/simple.html
I created an "export" function using the two functions above.
But,
Little rows "export" are fine, but ...
More than 1000 rows takes considerable time.
I want to get some advice on this part.
First, my development environment
- The latest version of "DataTables" related plug-ins.
- Spring, ibatis, oracle, java 1.8
- IE 11, Chrome 55.0.2883.87 m (64-bit)
- ajax
Etc
(Let me know if I have more information)
Second, the "DataTables" script
Https://datatables.net/extensions/scroller/examples/initialisation/large_js_source.html
Using the above functions
Function fn_search () {
Var parm1 = $ ("# srchParm1"). Val ();
If (parm1 == null || parm1 == "") {
Alert ("Please select parm1");
Return;
}
$ .ajax ({
Type: "POST",
DataType: "json",
Async: false,
Url: "/listTest.json",
Data: {
Parm1: parm1,
},
Success: function (data) {
Var items = [];
$ .each (data.listTest, function (idx, item) {
Var row = idx + 1;
Items.push ([
Row,
Item.name,
Item.telNo
]);
});
DoMasterInsertData (items);
},
Error: function (request, status) {
Return;
}
});
}
Function doMasterInsertData (data) {
$ ("# MasterTable"). DataTable ({
"Buttons": ['excelFlash'], //Or 'excelHtml5'
"AutoWidth": true,
"Destroy": true,
"Data": data,
"ScrollX": true,
"ScrollY": "70%",
"ScrollCollapse": false,
"Paging": true,
"PagingType": "simple_numbers",
"Info": false,
"Searching": false,
"Dom": '<"top"> rt <"bottom" Bflp> <"clear">'
"DeferRender": true,
& Quot; lengthMenu & quot ;: [[20, 30, 50, 100], [20, 30, 50, 100]
"Columns": [
{ClassName: "grid_data_c"},
{ClassName: "grid_data_c"}
]
"Language": {
"EmptyTable": "Data does not exist.",
"LengthMenu": "maximum bar MENU",
"Paginate": {
"First": "First",
"Last": "last",
"Next": "Next",
"Previous": "previous"
}
},
"InitComplete": function (settings, json) {
CommonObj.innerInputBind ("masterTable");
CommonObj.innerSelectBind ("masterTable");
CommonObj.gridResizeId ("masterTable");
SetTimeout (function () {commonObj.gridOrder ("masterTable", [0, "asc"]);
},
"FooterCallback": function () {
Var api = this.api ();
If (api.data (). Length> 0) {
$ (Api.column (0) .footer ()). Html (api.data (). Length.money () + "key");
}
}
});
}
Separately call "ajax" and draw "DataTables".
By doing this,
Is the export speed slower, of course?
If so, change the script as shown below
Is it possible to solve it?
Https://datatables.net/extensions/scroller/examples/initialisation/server-side_processing.html
I'll change the ajax call in the DataTables until the answer comes up
I'm sorry I could not include the js example.
Thank you for reading.
This question has an accepted answers - jump to answer
Answers
See the How can I export the whole table when using serverSide FAQ before you use server-side processing.
Can you try the HTML5 export buttons - is that faster? If you profile the Javascript, what does it say is the slow part?
Allan
Hello Allan !!
Thanks for the answer.
Change "excelHtml5" and debug in "Chrome"
Like photos
"_addToZip (zip, xlsx);" <- It takes a long time here.
Is it going to take a long time here?
What did I do wrong? T.T
Oh my ...
I found the problem.
//////////////////////////
Buttons.html5.js
476 Line
str = str.replace( /<(.?) xmlns=""(.?)>/g, '<$1 $2>' );
//////////////////////////
I commented out and executed it.
The speed was right.
The development pc is not external Netwrok.
If this causes problems
I will check and respond.
Thanks
Thanks! There is another thread that discusses that issue. I plan to have that fixed in the next release of Buttons.
Thanks,
Allan
Hello Allan !!
Thanks for the answer.
I checked the issue !!
I'll wait till the next release
Thanks ^ ___ ^