10-13-2021 07:48 PM
Is there a way, other than html or CSS or whatever, to programmatically control the width of the columns in a tree control?
Or, at the very least, make them stay the way they were when the gviweb was last saved?
Solved! Go to Solution.
10-27-2021 08:40 AM
Hello Mihai, I ran into the same issue. There is no property that allows a user to control the column width. I created a simple project that only contained a tree control with 5 columns and a while loop. When the app runs the columns all seem to resize to some default value. I found a work around by modifying a section of "index.gviweb". There is a section called <TreeControl> in my example that started out as
<TreeControl AllowSelection="[bool]False" BaseName="[string]Tree" ColumnHeaderVisibility="[SMVisibility]Visible" DataSource="{DataItemBinding Id=aa169a27c19542869751fefd38f35cf7}" DataSourceType="[Type]@8bfd7e5a29ba4234a66c12b3982cdcf3" Height="[float]408" Id="4423087e78a84b03b30d41c02d8c3956" Label="[UIModel]55475799827f44639a60c47736385c85" LabelLinked="[bool]True" Left="[float]132" SelectionMode="[SMTreeSelectionMode]One" TabIndex="[int]0" Top="[float]148" Width="[float]280" xmlns="http://www.ni.com/Controls.LabVIEW.Design">
<TabularControlColumn Id="48f4cc0802e04b998b929b66c8a0c7f3" Width="[double]NaN" />
<TabularControlColumn Id="f4b4fce13a7244bc9b5eb0573c8b0863" />
<TabularControlColumn Id="1546b828b06f4ca8908206ea2bd9ddfa" />
<TabularControlColumn Id="93751ed4c96b409fa01e767e8e74436b" />
<TabularControlColumn Id="7c44f8eb2ccb4453bb42d8227b689c5e" />
<FontSetting FontFamily="Segoe UI" FontSize="9" Id="8797b0637f9b48f8b8347b170e9a93a8" xmlns="http://www.ni.com/PlatformFramework" />
</TreeControl>
I modified all of the <TabularControlColumn Id.......> sections to <TabularControlColumn Id...... "Width=[double]50"/> to set my column to 50 px wide. Saved and reloaded the project and now all of the columns are the size I want.
10-30-2021 09:52 PM
I suppose I should have posted here the solution I found, sorry to be so slack.
I found on GitHub Milan's web vi's experiments https://github.com/rajsite/webvi-experiments
I picked up from there a JavaScript which I incorporated in my application and now I can set my tree control's columns programmatically. It should work for everyone else.
11-03-2021 11:40 PM
@Mihai wrote:
I suppose I should have posted here the solution I found, sorry to be so slack.
I found on GitHub Milan's web vi's experiments https://github.com/rajsite/webvi-experiments
I see, thank you for the link,
I also learn a lot from the following link A curated list of awesome WebVIs | LaptrinhX also belongs to Raj Milan.