Load multiple values at once?

Hi,I am trying to load +- 2000 values in specific cells.
If i try to do this using the XLEdit.updateValue it takes around 10 seconds to load.

Is there some way to load these values all at once in order to make it faster? 
The test-code i use is as following:

var excelObj = $("#Spreadsheet").data("ejSpreadsheet");
            var i = 1;
            while (i < 400)
            {
                excelObj.XLEdit.updateValue("A" + i, i); 
                excelObj.XLEdit.updateValue("B" + i, i + 1); 
                excelObj.XLEdit.updateValue("C" + i, i + 2); 
                excelObj.XLEdit.updateValue("D" + i, i + 3); 
                excelObj.XLEdit.updateValue("E" + i, i + 4); 
               i++;
            }

3 Replies

SK Shanmugaraja K Syncfusion Team October 30, 2017 05:53 AM UTC

Hi Tim, 
 
Thanks for using Syncfusion products, 
 
We have checked your code example, and we suggest you to use updateRange method to get a better performance for updating range of cells. Please check the below code example. 
 
[JS] 
 
 
        var data = [], i = 0; 
        while (i < 2000) { 
            data.push({ Product: "XYZ" + i, Price: "2000" + i, Item: "XYZ" + i, ID: "2000" + i }); 
            i++; 
        } 
        function updateData() { 
            var excelObj = $("#Spreadsheet").data("ejSpreadsheet"); 
            excelObj.updateRange(1, { dataSource: data, startCell: "A1" }); 
        } 
        $(function () { 
            $("#Spreadsheet").ejSpreadsheet({ 
                scrollSettings: 
                { 
                    width: "100%", 
                    height: 470 
                }, 
                allowOverflow: false 
            }); 
        }); 
 
 
Also, if you don’t want the overflow feature, you can disable by using allowOverflow property. We have demonstrated this in our JSPlayground, please check the below link and documentation link, 
 
 
Regards, 
Shanmugaraja K 



TI Tim October 30, 2017 11:49 AM UTC

Thanks for the feedback,

however what i am after is not exactly to specify multiple values in a table and display starting at A1.

I am trying to add values in specific cells, so could be A1, A2, A3, B7, C9, F99, ....



SK Shanmugaraja K Syncfusion Team October 31, 2017 05:10 AM UTC

Hi Tim,  
 
Thanks for your update,  
 
We suggest you to set allowUndoRedo as false while calling updateValue method to get a better performance. Please check the below code example.  
 
[JS]  
 
 
        function updateData() { 
            var excelObj = $("#Spreadsheet").data("ejSpreadsheet"); 
            var i = 1; 
            excelObj.option("allowUndoRedo", false); 
            while (i < 400) { 
                excelObj.XLEdit.updateValue("A" + i, i); 
                excelObj.XLEdit.updateValue("B" + i, i + 1); 
                excelObj.XLEdit.updateValue("C" + i, i + 2); 
                excelObj.XLEdit.updateValue("D" + i, i + 3); 
                excelObj.XLEdit.updateValue("E" + i, i + 4); 
                i++; 
            } 
            excelObj.option("allowUndoRedo", true); 
        } 
 
 
We have demonstrated this in our JSPlayground, please check the below link. 
  
 
Please check the above link and get back to us if this not fulfilling your requirement. 
  
Regards,  
Shanmugaraja K 


Loader.
Up arrow icon