Spreadsheets / WickedGrid

Easy & Wicked Fast spreadsheets for the web
http://spreadsheets.github.io/WickedGrid
587 stars 131 forks source link

how to open new sheet by giving the json as input #105

Closed srivasmca closed 7 years ago

srivasmca commented 7 years ago

when click on open button it will take json as input. then how to open sheet with data from json? var myjson = [{"title":"Information Functions","rows":[{"height":18,"columns":[{"value":"Function","class":"styleBold styleCenter"},{"value":"Execution","class":"styleBold styleCenter"},{"value":"Desired Result","class":"styleBold styleCenter"},{"value":"Correct?","class":"styleBold styleCenter"},{"value":"Notes","class":"styleBold styleCenter"}]},{"height":18,"columns":[{"value":"ISNUMBER"},{"formula":"ISNUMBER(100)","value":true},{"formula":"TRUE()","value":true},{"formula":"IF(B2 = C2, TRUE, FALSE)","value":true}]}],"metadata":{"widths":["120","120","120","120","120"],"frozenAt":{"row":0,"col":0}}}];

$("#btnOpen")
  .click(function () {
   tables = $.sheet.dts.toTables.json(myjson);
var mySheet  = $('#sheet').getSheet();
mySheet.openSheet(tables);
  });  });

with this code sheet is opened with json data but menu is going to below sheet i need to load sheet only.how to do it?

MrH2H commented 7 years ago

I have the same problem. Has this problem been solved? @srivasmca

srivasmca commented 7 years ago

Hi problem is fixed.

$("#btnOpen")
  .click(function () {
   tables = $.sheet.dts.toTables.json(myjson);
var mySheet  = $('#sheet').getSheet();
mySheet.openExistingSheet(tables);
  });  });

i have added openExistingSheet function in jquery.sheet.js

openExistingSheet:function (tables) {
s.parent .html(tables) .sheet(s); },