VMware {code} Community
mayur_virtualiz
Enthusiast
Enthusiast
Jump to solution

Sort existing column (eg: Status) on click of ColumnHeader for VM grid

Hello,

In Vsphere Webclient,

Inventory -> VM Grid:

     Vmware provide few existing columns, few are sortable like Name, State, etc. on the click of columnHeader and few are non sortable.

Is there any way to make existing non-sortable column to sortable?

I wanted to make it for "Status" Column.

Any help or any suggestion will be highly appreciable.

Thanks in advance,

Mayur

1 Solution

Accepted Solutions
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

If you want to make your newly added columns sortable, there is an example in the SDK that demonstrates this.

Please look at the chassisRackVSphere-ui sample.

            <!-- Chassis name column -->

            <com.vmware.ui.lists.ColumnContainer>

              <uid>com.vmware.samples.chassis.column.name</uid>

              <dataInfo>

                  <com.vmware.ui.lists.ColumnDataSourceInfo>

                    <!-- Column header -->

                    <headerText>#{name}</headerText>

                    <!-- Object property whose text value will be displayed (array of 1 elt) -->

                    <requestedProperties>

                        <String>name</String>

                    </requestedProperties>

                    <!-- Use sortProperty to allow column to be sorted with header click -->

                    <sortProperty>name</sortProperty>

                    <!-- Use exportProperty to allow column data to be exported -->

                    <exportProperty>name</exportProperty>

                  </com.vmware.ui.lists.ColumnDataSourceInfo>

              </dataInfo>

            </com.vmware.ui.lists.ColumnContainer>

The sortProperty should enable the sorting. And of course your backend service should support that. In the example this is the chassisRackVSphere-service.

View solution in original post

5 Replies
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

Hi Mayur,

If a column is sortable or not is programmed in the code base. It is not configurable by the user.

You can file an SR for improvement if you like.

Thanks,

~Peter

mayur_virtualiz
Enthusiast
Enthusiast
Jump to solution

Thanks Peter,

You are 100% correct, Actually I wanted to know, whether can we programmatically make existing column as a sortable.

Because, I believe all the columns might be defined by same rule, but few of them are sortable and few are not. So there might be any property that we can programmatically change.

Is it possible.?

Or

I need to extend from "com.vmware.ui.lists.*" of the VMWare and set its PropertyProviderAdaptor at Java.

Please suggest.

Thanks,

Mayur

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

Hi Mayur,

Let me check if I understand your question correct.

You want to write a plugin that uses column extensibility and you want to modify the existing columns (not the ones that you add to the list). Is this correct?

If this is the case, I don't think that you can do that.

~Peter

0 Kudos
Peter_Ivanov
VMware Employee
VMware Employee
Jump to solution

If you want to make your newly added columns sortable, there is an example in the SDK that demonstrates this.

Please look at the chassisRackVSphere-ui sample.

            <!-- Chassis name column -->

            <com.vmware.ui.lists.ColumnContainer>

              <uid>com.vmware.samples.chassis.column.name</uid>

              <dataInfo>

                  <com.vmware.ui.lists.ColumnDataSourceInfo>

                    <!-- Column header -->

                    <headerText>#{name}</headerText>

                    <!-- Object property whose text value will be displayed (array of 1 elt) -->

                    <requestedProperties>

                        <String>name</String>

                    </requestedProperties>

                    <!-- Use sortProperty to allow column to be sorted with header click -->

                    <sortProperty>name</sortProperty>

                    <!-- Use exportProperty to allow column data to be exported -->

                    <exportProperty>name</exportProperty>

                  </com.vmware.ui.lists.ColumnDataSourceInfo>

              </dataInfo>

            </com.vmware.ui.lists.ColumnContainer>

The sortProperty should enable the sorting. And of course your backend service should support that. In the example this is the chassisRackVSphere-service.

mayur_virtualiz
Enthusiast
Enthusiast
Jump to solution

Thanks Peter,

I guess that the only solution left to write my propertyProviderAdaptor class which will sort for for me.


But thanks lot for your response.

Regards,

Mayur Mankar

0 Kudos