on 03-14-2017 9:39 AM
Hi all,
i have a an xml model created with data coming from back-end through soap.
I serialize the xml response and set to the model as shown below:
var xmlTextPlaning = new XMLSerializer().serializeToString(returnValRegolePlanning);
var xmlPlanning = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + xmlTextPlaning;
window.modelloDatiPlanning = new sap.ui.model.xml.XMLModel();
window.modelloDatiPlanning.setXML(xmlPlanning);
Then i create a table in the xml view as below:
<t:Table
id="Planning2R"
selectionMode="MultiToggle"
showColumnVisibilityMenu="true"
enableColumnFreeze="true"
columnSelect="onColumnSelect"
>
</t:Table>
Then i bind the columns(from another model) and the rows from my model:
oTablePlan = this.getView().byId('Planning2R');
oTablePlan.setModel(window.Pla_Model_Colonne, 'colonnePlanning');
oTablePlan.setModel(window.modelloDatiPlanning, 'righePlanning');
oTablePlan.bindColumns("colonnePlanning>/columns", function(index, context) {
var sColumnId = context.getObject().fieldname;
var Des = context.getObject().ddtext;
var isKey = context.getObject().keyflag;
var noDisp = context.getObject().no_display;
if (noDisp == 'X'){
return new sap.ui.table.Column({
id : "planr2"+sColumnId,
label: Des,
template:new sap.ui.commons.TextView({"text" : {path: "righePlanning>" + sColumnId}}),
sortProperty: sColumnId,
filterProperty: sColumnId,
autoResizable: true,
visible: false
});
}
else {
return new sap.ui.table.Column({
id : "planr2"+sColumnId,
label: Des,
template:new sap.ui.commons.TextView({"text" : {path: "righePlanning>" + sColumnId}}),
sortProperty: sColumnId,
filterProperty: sColumnId,
flexible: true,
resizable: true,
autoResizable: true,
width : 'auto',
});
}
});
oTablePlan.bindRows("righePlanning>/item");
And until here everything is working fine. i have the table, the data and everything else.I want to download all the data with a download button but when i have thousands of rows the download takes too much or even the broswer doesnt respond anymore. when i have hundred of rows the download works. The issue is related to the xml model i think because with a json model the download is very fast even with hundred thousands of data.
my download function is this:
downloadCSV: function(){
var currentdate = new Date();
var anno = currentdate.getFullYear()
var mese = currentdate.getMonth()+1
var giorno = currentdate.getDate()
var minutes = currentdate.getMinutes();
var hour = currentdate.getHours();
var str = String(giorno+"/"+mese+"/"+anno+"_"+hour+"."+minutes)
jQuery.sap.require("sap.ui.core.util.Export");
jQuery.sap.require("sap.ui.core.util.ExportTypeCSV");
oTablePlan.exportData({
exportType: new sap.ui.core.util.ExportTypeCSV({
separatorChar: ";"})
})
.saveFile("Regole_Planning_"+str)
.always(function() {
this.destroy();
});
},
Last time it tooked more than 25 minutes to download a file of 15k rows (1,74MB) and my connection have a download speed of 25Mb/s.
is there any restriction to go only with XML model instead of JSON?
try converting XML model to JSON, check the sample JSFiddle code
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.