Hello,
Is that possible to do a custom sorting for columns? Also I'd like to know if this is possible to make a sorrting for template column? I didn't find anything in documentation.
Thank you.
Hi dprosko,
Sorting is not possible on a templated column as it is not actually bound to anything. You could sort of hack it by handling mouse events on the header and then sorting a hidden data bound column bound to the actual data.
Custom sorting could be accomplished one of two ways. Use a data source where you can set the sorting algorithm or comparer so that ascending/descending is how you want it. Or in 11.1, there is custom data binding for the grids. You can supply a source and the grid will bind to it without sorting, filtering, etc. But the UI is maintained for you.
regards,
David Young
Dear
I have a web data grid with auto generate column is true. The web data grid uses event handler OnCustomDataBinding. I want to sort column in web data grid.
For example:
<ig:WebDataGrid ID="PersonalGrid" runat="server" Width="99%" Height="200px" EnableDataViewState="true" AutoGenerateColumns="true" EnableViewState="true" OnCustomDataBinding="PersonalGrid_CustomDataBinding"> <Behaviors> <ig:Sorting> <ColumnSettings> <ig:SortingColumnSetting Sortable="true" ColumnKey="SID_NO" /> </ColumnSettings> </ig:Sorting> <ig:RowSelectors Enabled="true" RowNumbering="true"> </ig:RowSelectors> <ig:Selection CellClickAction="Row" CellSelectType="Single" RowSelectType="Single"> </ig:Selection> <ig:Paging PageSize="2" PagerAppearance="Bottom" Enabled="true"> </ig:Paging> </Behaviors> </ig:WebDataGrid>
DataSet ds = new DataSet(); protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=server name;Initial Catalog=TEST;Integrated Security=True; User Id=sa; Password=1234;"); SqlDataAdapter adap = new SqlDataAdapter("Select caObjectID, CID_NO, UID_NO, SID_NO, Enabled, LastEdit from EMP_INFO", con); adap.Fill(ds, "Products"); PersonalGrid.DataSource = new List<Object>(); }
protected void PersonalGrid_CustomDataBinding(object sender, DataBindingEventArgs e) { e.Cancel = true; e.DataSource = ds; }
Can anybody solve this issue...Please as early as possible.....
Regards
Suday