19 Answers, 1 is accepted
You can use the following approach that is not part of the documented public API:
http://dojo.telerik.com/UtajU
... or this one that uses documented methods and options only:
http://dojo.telerik.com/IHURo
Alternatively, you can remove a given sheet via the removeSheet() method, and insert an empty one (or a sheet with the desired options) via the insertSheet() method:
http://dojo.telerik.com/UtajU/2
I hope this helps.
Regards,
Dimiter Topalov
Telerik by Progress
Hey Dimiter!
In the undocumented example, what does kendo.spreadsheet.SHEETREF represent? Can I use spreadSheet.options.sheets[0]?
Thanks!
Marc
Also when using SHEETREF, I get the following:
angular.js:21778 RangeError: Invalid array length
at init.values (kendo.all.js:106562)
at init._sheetChange (kendo.all.js:127561)
at init.trigger (kendo.all.js:137)
at init.triggerChange (kendo.all.js:108951)
at init.batch (kendo.all.js:109812)
at init.clear (kendo.all.js:106638)
at Object.fn (current-stage-sku-line-results.js:110)
at k.$digest (angular.js:21778)
at k.$apply (angular.js:21778)
at h (angular.js:21778)
My statement is this: spreadSheet.activeSheet().range(kendo.spreadsheet.SHEETREF).clear();
Thanks!
Sorry I forgot to mention before - I am using the spreadsheet with a remote datasource, so I think what I'm really looking for is a way to clear all the data from the dataSource.
Thanks!
Thank you for clearing up the desired functionality. To "clear" all the data from the dataSource, call the dataSource.data() method, passing it an empty array:
http://dojo.telerik.com/aQORa
As for the kendo.spreadsheet.SHEETREF - it is used internally, and basically creates a range, representing the whole sheet. You can find the specific implementation in our source code (kendo.spreadsheet.js file), if you are interested.
Regards,
Dimiter Topalov
Telerik by Progress
Hi Dimiter,
How to clear the applied "Filter" condition for the entire spreadsheet....
Best Regards...
To clear the applied filter condition for the entire Spreadsheet Sheet, you will first need to get reference to the range, that represents the entire Sheet:
var
spreadsheet = $(
"#spreadsheet"
).data(
"kendoSpreadsheet"
);
var
sheet = spreadsheet.activeSheet();
var
rowsCount = sheet._rows._count;
var
columnsCount = sheet._columns._count;
var
sheetRange= sheet.range(0, 0, rowsCount, columnsCount);
Then you could reset the filter condition:
sheetRange.filter(
false
);
sheetRange.filter(
true
);
Regards,
Veselin Tsvetanov
Progress Telerik
Hi Veselin,
thank you very much ..its working perfectly ..
Best Regards...
Hi Veselin,
How tp get the total rows count after "filter" is applied, is there Jquery event while filtering ..
Best Regards,
Hi Veselin,
How to add ActionLink to the spreadsheet row-column.. please advice ...
Best Regards,
I am afraid that 'filtering' event in Kendo UI Spreadsheet is not supported. Also there is no built in functionality for adding ActionLink to row or column.
I would suggest you to log your ideas in our Feedback Portal. This way the other users can vote for the ideas. The issues which gain more popularity will be considered for future implementation.
Regards,
Neli
Progress Telerik
Hi Neli,
Thank you very much for your details.. very disappointing ..could you please advice me to get the spread sheet selected row column value in Jquery ..
Best Regards..
Hi Neli,
I managed to get the selected value..thank you..
Best Regards,
After a discussion with our developers I can suggest you a custom solution in order to find the total rows in the Spreadsheet after filtering.
You can check the total rows count in the Spreadsheet by using the following
var
totalCount =
this
.view._sheet.toJSON().rows.length;
Then, for every row you can check if it is hidden or not and increase/decrease respective counters:
for
(
var
i = 0; i <
this
.view._sheet.toJSON().rows.length; i++) {
if
(
this
.view._sheet.isHiddenRow(i)) {
totalCount--;
hiddenRows++
}
}
I hope you will find the linked Dojo example helpful
Regards,
Neli
Progress Telerik
Hi Neli,
Could you please give me the sample in Razor syntax ...
Best Regards..
There will not be huge difference if you use Kendo UI for jQuery widgets or the ASP.NET MVC wrappers. You will declare the Spreadsheet widget in a different way. You can take a look of the Spreadsheet Demos for MVC on the following link.
In both cases you will need to include the following script:
<script>
kendo.spreadsheet.Controller.fn.onCommandRequest =
function
(e) {
if
(e.command) {
this
._execute(e);
}
else
{
this
._workbook.undoRedoStack[e.action]();
}
if
(e.command ===
"ApplyFilterCommand"
) {
var
totalCount =
this
.view._sheet.toJSON().rows.length;
var
hiddenRows = 0
alert(totalCount-1);
for
(
var
i = 0; i <
this
.view._sheet.toJSON().rows.length; i++) {
if
(
this
.view._sheet.isHiddenRow(i)) {
totalCount--;
hiddenRows++
}
}
alert(
'hidden: '
+ hiddenRows);
}
}
</script>
Regards,
Neli
Progress Telerik
Could you please describe the issue in more details? The sample provided previously is used to show the total count of hidden rows when the data in the Spreadsheet is filtered. The provided script does not affect the styles of the widget so no background is cleared. Here is a screencast. Please let me know if I am missing something.
Regards,
Neli
Progress Telerik