Hello from Germany,
databinding an UltraGrid (ugrMyData, v16) to a DataTable in a DataSet works fine:
ugrMyData.DataSource = dstTreeBuilder.MyData;
The UltraGrid is editable and passes new and updated rows to the DataTable.
Now imagine that, instead of the whole DataTable, the Ultragrid is supposed to show a subset only. The filter predicate would be Kind of "F_Category_ID IN (5,6,7,8)", where the list of integers is generated by an existing LINQ function to "flatten" a hierachy (5 = parent, 6,7,8 = children of 6, so the grid shows "5 and its children".
At first glance, I'd code:
from d in dstTreeBuilder.MyData
join h in GetDescendants(oCurrentCategory) //returns the List<int> of the hierachy ids
on d.F_Hierarchy_ID equals h
select d
This does the job of filtering. But: this is an EnumerableRowCollection, not a DataTable. So, any new or editited row for this subset is sent to nowhere....
How can I get the "DataTable edit behaviour" for a linq-based subset of a datatable?
Thanks and regards
Martin
Thanks, I've rebuilt it this way. Case closed :).
BTW I suggest a new feature to the UltraWingrid RowFilter: if the list is not all to big, a new Operator IN (1,2,3...) could be handy here. Although RowFilter is a very powerful feature, this operator is not available.
Are you using the UltraGridFilterUIProvider? It gives you a dropdown list with checkboxes, so you can check off all the values you want to filter in, just like Excel.