How to set Freezing row for file that is loading data from database

I am loading data from database using openUrl  <ejs-spreadsheet>

How can I set firs row as freezing



1 Reply 1 reply marked as answer

BP Babu Periyasamy Syncfusion Team August 28, 2023 02:28 PM UTC

Hi Mahesh,


Your requirement can be achieved by setting the frozenRows property of SheetModel in the openComplete event. Here, we have attached the code block and sample for your reference.


Code Block:


<script>

   function created() {

       var spreadsheet = ej.base.getComponent(document.getElementById('container'), 'spreadsheet');

       fetch(https://js.syncfusion.com/demos/ejservices/data/Spreadsheet/LargeData.xlsx) // Fetch the remote url.

           .then((response) => {

               response.blob().then((fileBlob) => { // Convert the excel file to blob.

                   var file = new File([fileBlob], "Sample.xlsx"); //Convert the blob into file.

                   spreadsheet.open({ file: file }); // Open the file into Spreadsheet.

               })

           })

   }

    function openComplete() {

       var spreadsheet = ej.base.getComponent(document.getElementById('container'), 'spreadsheet');

       var sheet = spreadsheet.getActiveSheet();

       spreadsheet.sheets[sheet.index].frozenRows = 1; // Set first row as frozen using the frozenRows property of sheet.  

    }

</script>


Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Frozen_row_core_sample-1771448574

In the above sample, we have fetched the file with the url and opened using the open method in the created event. And we have set the first row as frozen in the openComplete event.


However, we have prepared a video to demonstrate freezing the row of the sheet which is imported using the open option in the file menu.


Video link:

https://www.syncfusion.com/downloads/support/directtrac/general/ze/Frozen_row_core_on_importing295282516


Kindly, check the above provided sample and video and get back to us , if you need further clarifications


Marked as answer
Loader.
Up arrow icon