Technote (FAQ)
Question
Why is the output different when using IRowFilter since version 3.5 ?
Cause
Starting in version 3.5, after the rows are filtered, they are also sorted.
Answer
You can override this behavior by sorting the rows each time the tree model changes.
For instance in the DragDrop sample, available in IBM ILOG Gantt .NET distribution, add the following before setting the RowFilter on each scheduleChart to force the rows to be sorted by Name.
TreeModelView mView1 = scheduleChart1.GanttTable.TreeModelView;
mView1.TreeModelChanged += new TreeModelChangeEventHandler(mView_TreeModelChanged);
TreeModelView mView2 = scheduleChart2.GanttTable.TreeModelView;
mView2.TreeModelChanged += new TreeModelChangeEventHandler(mView_TreeModelChanged);
And the mView_TreeModelChanged method is the following:
bool sorting = false; // this is needed to avoid infinite loop as SortRows
// method will fire TreeModelChanged event.
void mView_TreeModelChanged(object sender, TreeModelChangeEventArgs e)
{
if (!sorting)
{
sorting = true;
((TreeModelView)sender).SortRows(null, "Name", true, -1);
}
else
sorting = false;
}
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.