Enable filtering after loading remote data

1 Answer 13 Views
Spreadsheet
Scott Hannon
Top achievements
Rank 1
Scott Hannon asked on 26 May 2021, 06:52 PM | edited on 26 May 2021, 07:01 PM

How do I set the spreadsheet column filters as active after loading remote data? I'm not applying any filters, only activating the dropdowns on each column.

I've tried setting it when adding a new sheet (commented out), as well as through code (last line), but can't get either method to work.

let ssResults = $("#spreadsheet").kendoSpreadsheet({
	rows: 10,
	columns: 10,
	columnWidth: 192
}).data("kendoSpreadsheet");
let goodData = $.parseJSON(dataResults.d);
//put results in spreadsheet
let columnWidth = Object.keys(goodData[0]).length;//column count
let columnName = getCharFromNumber(columnWidth);//custom function to get excel letter column
ssResults.insertSheet({
	rows: goodData.length + 2//, //header + info
	//filter: {
	//    ref: "A2:" + columnName + (goodData.length + 2).toString() // Headers
	//},
});
ssResults.activeSheet(ssResults.sheets()[ssResults.sheets().length - 1]);
ssResults.activeSheet().setDataSource(goodData);
ssResults.activeSheet().insertRow(0);
ssResults.activeSheet().range("A1:" + columnName + "1").merge().value(queryInfo).wrap(true);
ssResults.activeSheet().filter.ref = "A2:" + columnName + (goodData.length + 2).toString();

1 Answer, 1 is accepted

Sort by
0
Accepted
Neli
Telerik team
answered on 31 May 2021, 11:44 AM

Hello Scott,

In case you need to just add the filtering option after the data has been loaded in the Spreadsheet I would suggest you pass 'true' to the Range filter method:

sheet.range("A1:E78").filter(true);

Here is a Dojo example where this is demonstrated.

I hope you will find the provided suggestion helpful.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Scott Hannon
Top achievements
Rank 1
commented on 31 May 2021, 02:32 PM

Works great! Thank you.
Tags
Spreadsheet
Asked by
Scott Hannon
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or