23 days to give it a try before you buy! Download now. The best deals on licenses are coming soon Download now. The best deals on licenses are coming soon

Data Serialization, JavaScript Programming Example of Data Serialization in SpreadSheet

JavaScript Programming Example of Data Serialization in SpreadSheet

You will have to serialize your SpreadSheet data If you need to convert it into another programming language for further storage or sharing. See a free coding sample of serialization in Webix SpreadSheet.

JS Code

function getData(){
  var text = JSON.stringify( $$("ss").serialize(), null, "  ");

  $$("txt").setValue( text );
}
function setData(){
  var data =  $$("txt").getValue();
  $$("ss").reset();
  $$("ss").parse(data);
}

webix.ready(function(){
  var buttons = { width:350, rows:[
    { view:"button", value:"Serialize data", click:getData },
    { view:"textarea", id:"txt" },
    { view:"button", value:"Load data Back", click:setData }
  ]};
  
  webix.ui({ 
    cols:[
      buttons,
      {
        view:"spreadsheet",
        id:"ss",
        toolbar: "full",
        data:{
          styles: [
            [ "blue", "#FFFFFF;#2244DE;" ]
          ],
          sizes: [
            [ 0, 2, 64 ]
          ],
          data: [
            [ 3, 2, "Webix", "blue" ],
            [ 3, 3, "SpreadSheet", "blue" ]
          ]
        },
        on:{
          onAfterLoad: getData
        }
      }
    ]
  });
});