Hi,
I am trying to extend an UltraGrid sample to implement expand / collapse functionality for Columns just like it is present for the rows in UltraGrid. However, I am not finding anything to extend this functionality for the Column Headers.
Hence, for this I intend to include + and - bitmaps on column headers of the grid. These bitmaps should be right aligned and should respond to the click. On click, the + and - bitmaps should toggle and invisible columns should become visible and vice versa.
Is there another approach by which I can implement this functionality?
Thanks and Regards,
Bhushan
Hi Bhushan,
There are three different ways of showing or hiding columns of an UltraGrid, based on your requirement you can choose one of them.
1. Expanding and collapsing the columns that are grouped in the following way is a new feature that will be included in our 16.1 release. http://help.infragistics.com/doc/WinForms?page=WinGrid_Grouping_Columns_in_Row_Layout_Mode_using_the_Designer.html
2. If you want to add buttons to expand and collapse widths of individual columns then you can achieve this with a Creation Filter. You can read more about a creation filter here. http://help.infragistics.com/doc/WinForms?page=Win_Creation_Filter.html
3. You can use a ColumnChooser to show or hide your columns. If you want to read more about column chooser please use the below link. http://help.infragistics.com/doc/WinForms?page=WinGrid_Using_the_Column_Chooser_Feature.html
If you are looking for any built in functionality that allows you to add expand or collapse buttons for columns then that has to be a new product idea. You can suggest new product ideas for future versions (or vote for existing ones) at <http://ideas.infragistics.com>.
Submitting your idea will allow you to communicate directly with our product management team, track the progress of your idea at any time, see how many votes it got, read comments from other developers in the community, and see if someone from the product team has additional questions for you.
Remember when submitting your idea to explain the context in which a feature would be used and why it is needed as well as anything that would prevent you from accomplishing this today. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. You can also link back to this thread for additional details.Thank you in advance to submitting your product idea.
Please let me know if you need any further assistance in implementing any of the above suggested approaches.
Sincerely,Sahaja KokkalagaddaAssociate Software Developer, Windows Formshttp://ko.infragistics.com/
Hi Sahaja,
Thanks for the response. I have been able to implement the column expand and collapse indicators and they have worked well so far for a sample application with dummy data. However, there are problems in the implementation in a real world application. The sample I got had hierarchical group headers shown and these spanned the entire set of width for the Child Column headers. Similarly the parent group headers spanned the child groups underneath and so forth...However, I needed a functionality to show a single header row with excel style (+/-) expansion indicators in the column headers. So I tweaked the sample code in two steps.
Firstly, I had to set the GroupHeadersVisible property to false and ColHeadersVisible property to true. The earlier sample I had was implementing the AfterCreateXXX and BeforeCreateXXX methods by retrieving the HeaderUIElement. From that HeaderUIElement, the sample was extracting the GroupHeader element and this I had to change to ColumnHeader element to draw the + and - images. However, it was creating problems while displaying orphan columns. When I changed the RowLayoutInfo from GroupLayout to ColumnLayout, the (+/-) buttons would only Toggle, but not Hide/Show the columns in the Group. Then I read that this works only in GroupLayout mode. So I knew that this needed further customizations...
Secondly, to make this happen, in the ExpansionIndicator inherited class, I had to tweak the "GetGroup" method which returned the Group to expand or collapse the columns in a group, to return a List of columns that should toggle visibility on clicking of (+/-). I made similar tweaks to the code inside Toggle method, InitAppearance override and IsOpen property as well and it worked well. However, this was with the Groups present. So, I removed / commented out all the grouping code, and changed the RowLayoutInfo to ColumnLayout. With few more tweaks, it worked.
So my questions finally are...
[1] Is this the best available approach to implement this functionality?
[2] There is an ugly Row Header Column that I wish to disable, as I am not using it. Can u let me know how to turn this off?
[3] With all these tweaks, the functionality to Fix the column, does not work. I want to Fix the 0 th i.e., the LHS column and this should be without displaying the user an option to Fix the column. I have set the "UsedFixedHeaders" to true, "FixedHeaderIndicators" to None and one more property I am not able to recollect. In some other sample, it did work with these settings but not for this sample. Please advice
[4] Similar to the Column (+/-) indicators, I want to implement these buttons for Rows as well. Also, I need to show (+/-) indicators inside the left most column cells on LHS. I believe, I can do this selectively by retrieving the CellUIElement in the Create Filters option. But then it becomes more complex for the caller to identify which ExpansionIndicator needs to be applied. Since we can assign only a single CreationFilter object to a UltraGrid, this must be handled in the same Creation Filter class. I want to show, the options for Expand and Collapse for Columns as well as rows; but I do not want to use ChildBands (for rows) or Groups (for columns) Let me know how can this be achieved.
[5] Since the data I am working with is Hierarchical with a varying parent child structure, I do not want to use ChildBands. I need to Show (+/-) and do indentation in the LHS of the left most column's cells. While I found out that indentation property is only available at the band level, I need to know if there is an alternative to achieve the same.
[6] On cell click, I need to add child rows with indentation. But this would only happen for certain selected cells in which the value text is underlined to imitate a Hyperlink. In other words, a systematic drill down shall occur and the number of rows added is determined after the cell is clicked and data is fetched. Some where in the UltraDataSource category, I saw the code to do so at the following location:
http://ko.infragistics.com/community/forums/t/89761.aspx
Is this the best approach to achieve this?
[7] I am doing the designing of the Ultra Grid outside the Initialize Component. Instead of our traditional designer file approach, I have a controller which holds the data structure, UltraDataSource and UltraWinGrid and I have calls to fetch the data, Pump that data into the UltraDataSource, bind the UltraDataSource to the UltraGrid and then call Show on the UltraGrid. I have assigned eventhandlers to datasource and datagrid objects in the controller. However, certain things like Adding the grid to forms / parent, providing its dock, achor, size, location, etc is done in the InitializeComponent Method and then these instances are passed on to the controllers. I have not included the calls to BeginInit and EndInit and I do not seem to have any problems so far. Should I be calling these APIs and is there something I should know in this regards?
Thanks,
Any help on the above points is much appreciated. To add to these, I am having a few problems with the Creation Filter in a way that the Tags that I am sending for the Coumn via the HeaderUIElement is not retaining the correct data in it. Any idea as to how I can debug this? Asking this question as the mechanism by which the Creation Filter code is executed is little obscure...
Bhushan.