Hello Phil,
I see what the problem is. In order to overcome it, you could use the Data() method and pass additional data to the Read Action.
E.g.
.DataSource(dataSource => dataSource
.Ajax()
...
.Read(read => read.Action(
"Excel_Export_Read"
,
"Grid"
).Data(
"additionalData"
))
)
.Events(e => e.ExcelExport(
"excelExport"
)) //attach a handler to the excelExport event
<script>
var
isExport =
false
;
$(
"#grid"
).on(
"mousedown"
,
".k-grid-excel"
,
function
() {
isExport =
true
;
});
function
additionalData() {
return
{
isExport: isExport
}
}
function
excelExport(e) {
isExport =
false
;
}
</script>
This way we will pass the isExport flag variable to the Read Action. It will be set to true if the current request is related to the Excel export and to false otherwise.
I hope this information helps. Have a great day. Regards,
Dimiter Madjarov
Telerik
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Feedback Portal
and vote to affect the priority of the items