Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

GridView - How to use a built-in Context Menu to display summaries in Custom Binding mode

$
0
0

Having researched this scenario, we found that it's impossible to support it out of the box, since it requires implementing a separate action for the ContextMenu features. This example illustrates how to implement this scenario using custom callbacks: 
1) Handle the ASPxGridView.ContextMenuItemClick event to intercept the default logic and send a custom callback using MVCxClientGridView.PerformCallback : 

[JScript]
function OnContextMenuItemClick(s, e){if(e.objectType == "footer"){ e.handled = true; gridView.PerformCallback({ fieldName: s.GetColumn(e.elementIndex).fieldName, customCommand: e.item.name });}}

 

2) Read callback parameters (see Passing Values to a Controller Action through Callbacks) and manually modify the summary collection at the GridViewModel level using the GridViewModel.TotalSummary property. 

3) Modify the GridViewCustomBindingGetSummaryValuesHandler method's implementation to support all summary types ("Min", "Max" and "Average") 

Note that this approach will work for versions 14.2.8 and later (see GridView - It's impossible to change the summary state on a custom callback in Custom Binding mode).


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>