Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
245
WebDataGrid Custom Sort & Filter
posted

I have WebDataGrid version 10.3 and I need custom filtering and sorting applied to the grid.  Here are a couple examples of what I need done:

1. I have a column of integers, and many of them have a value of 0.  I need 0 to be considered the highest number for sorting purposes.  How do I accomplish this?  My current solution was to create a hidden column based on this column, and set any 0's to Int32.MaxValue.  This works for initial load, but I need the sort of this column to actually sort using the hidden column, rather than the column they actually clicked.

2. I need to be able to filter that column to show either zero or non-zero values. I also need the filter options to have custom names.  Basically I need to duplicate this UWG functionality:


uwgPurchPriceVar.Columns.FromKey("COMMODITY").FilterCollectionValues.Clear()
For Each item As String In CommodityFilterList
  uwgPurchPriceVar.Columns.FromKey("COMMODITY").FilterCollectionValues.Add(item, item)
Next

uwgPurchPriceVar.Columns.FromKey("UOM_CODE_DESCR").FilterCollectionValues.Clear()
For Each item As String In UOMFilterList
  uwgPurchPriceVar.Columns.FromKey("UOM_CODE_DESCR").FilterCollectionValues.Add(item, item)
Next

uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Clear()
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Add(0.75, "Less Than 75%")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Add(0.5, "Less Than 50%")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Add(0.25, "Less Than 25%")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Add(0.1, "Less Than 10%")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_CUMM_PERCENT").FilterCollectionValues.Add(0.0, "Greater Than 0%")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_RANK").FilterCollectionValues.Clear()
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_RANK").FilterCollectionValues.Add(1, "Ranked")
uwgPurchPriceVar.Columns.FromKey("CURRENT_QTR_RANK").FilterCollectionValues.Add(0, "Unranked")
uwgPurchPriceVar.Columns.FromKey("UNDER_CONTRACT").FilterCollectionValues.Clear()
uwgPurchPriceVar.Columns.FromKey("UNDER_CONTRACT").FilterCollectionValues.Add(True, "Under Contract")
uwgPurchPriceVar.Columns.FromKey("UNDER_CONTRACT").FilterCollectionValues.Add(False, "Not Under Contract")

Top Replies