This is a migrated thread and some comments may be shown as answers.

getOptions gives Uncaught TypeError: Converting circular structure to JSON

2 Answers 300 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 02 Oct 2015, 09:32 PM

Getting a "Uncaught TypeError: Converting circular structure to JSON" on JSON.stringify($("#grid").data("kendoGrid").getOptions()

I tried a variation of simpleStringify but didn't get anywhere.

Yes, I've read the docs, but I have no idea how to implement super-json (if that's the solution) for this.

Help is appreciated! Thanks!

2 Answers, 1 is accepted

Sort by
0
Alex
Top achievements
Rank 1
answered on 02 Oct 2015, 09:40 PM

Ok, I used a variation from here, but don't know how to persist groupby and not sure what else I'm missing by using this workaround.

 var state = {
            page: dataSource.page(),
            pageSize: dataSource.pageSize(),
            sort: dataSource.sort(),
            filter: dataSource.filter(),
            columns: grid.columns,
        }

localStorage["kendo-grid-options"] = JSON.stringify(state);

0
Alex
Top achievements
Rank 1
answered on 05 Oct 2015, 05:47 PM

 I've managed to get both groupby and sort working. Not sure if there is anything else missing but this seems to do the trick!

 

var state = {
           page: dataSource.page(),
           pageSize: dataSource.pageSize(),
           sort: dataSource.sort(),
           filter: dataSource.filter(),
           columns: grid.columns,
           groupable: dataSource.group()
       }

 and later

$("#grid").data("kendoGrid").dataSource.group(JSON.parse(options).groupable);
$("#grid").data("kendoGrid").setOptions(JSON.parse(options));
$("#grid").data("kendoGrid").dataSource.sort(JSON.parse(options).sort);
Tags
Grid
Asked by
Alex
Top achievements
Rank 1
Answers by
Alex
Top achievements
Rank 1
Share this question
or