Not able add sheet 2 values from the spreadsheet !!

I’m having two sheets in a spreadsheet. if i update the any column value of sheet 2, the sheet 1 's value is getting updated.

Hello,

Current Spreadsheet API presupposes that there’s a single sheet in the view. To correctly save multisheet data you need to send all the data to server after each change:

save:{
   data:{
     $proxy:true,
     save:function(view, data){
         data = {data:view.serialize({sheets:true})};
         webix.ajax().post("server/data.php?sheet=3", data);
     }
   }
}

E.g. https://webix.com/snippet/4757b8ce

But this like statically setting the sheet = 3. Is there any way the ajax post will happen dynamically according to the sheet on which the user is on. And also i’m not able to retain all the sheets on reload of the page.

Sorry to be that ambiguous. This url doesn’t point to any sheet, it was taken from our samples and it points to the 3rd Spreadsheet in our database.

The idea is that to save data per sheet, you need to collect all the data from all the sheets with spreadsheet.serialize({sheets:true}) method and then save the whole data into the database.

The data for multiple sheets that comes from the server during reloading, should be as follows:

{ sheets: [
   { 
      name: "Tab 1", 
      content:{ 
         data:[], ..etc
      }
   },
   {
      name: "Tab 2",
      content:{
         data:[], ..etc
      }
   }
]}

Also, if needed, you can pass the name of the active sheet to server: https://webix.com/snippet/02d0f9b2. But it is not safe as sheet names can be changed by user. The correct way was described above.

What about the styles spans sizes all those thing. I would really appreciate if you could give the code for it…

If you apply the spreadsheet.serialize({sheets:true}) it will save all the data, sizes, spans, ranges, condition, whatever. The full list of sheet properties are available by the link.

Will it save in each of the tables data, sizes, span, styles or how it is.

Yep, the spreadsheet.serialize({sheets:true}) collects all the data from the Spreadsheet including sheet data, spans, sizes, etc. And then you can post this data to server and save it to the database using your own server-side logic.

Yes its done. so thankful for the support. :smile: