The new revised Grid Control introduced in V4.3.1 is a great improvement and provides a lot of additional functionality.
I want to dynamically control the inclusion/exclusion of columns in the grid, to allow the one grid to work in different ways depending on attribute/s of the containing object e.g. a type picklist.
Can this be done using the rbf_getGridControlComponent(gridNo) and supporting getKendoConfig() interface? Or another way?
Regards,
Peter
You should be able to use the refresh function from Kendo UI widgets. That is: gridControl.refresh();
Thierry
PS: Really glad you like the new grid control - it does make bulk editing much more functional and pleasant.
After narrowing the grid, try calling the resize() method, I think that should update the scrollbar:
rbf_getGridControlComponent(0).getKendoConfig().resize();
Hello Peter,
At the onset, thank you for your positive feedback.
GridControl fields/columns are driven by GridControl component definition. Dynamically hiding GridColumn columns is NOT a supported use-case.
However, you can still considering leveraging Client-side SDK & applying this client-side override on form pages with GridControl. This should work for all the basis cases where in the following constraints are not violated:
Eg: To hide second column on first grid control in the page:
function hideGridControlColumn(gridControlIndex, columnIndex) { //To hide First GridControl's second column |
Request you to try out the above utility function and see if it meets your requirements.
Please note, the above snippet is shared only as an example and is not an in-built feature in product.
Hi Siraj,
Thanks for the function. Works quite well though if the original grid is wider than the page (and shows horizontal scrollbars), the grid still thinks it is as wide as the original (without the hidden columns).
Is there a refresh/resize option?
Regards,
Peter
You should be able to use the refresh function from Kendo UI widgets. That is: gridControl.refresh();
Thierry
PS: Really glad you like the new grid control - it does make bulk editing much more functional and pleasant.
Hello,
Hiding columns works well, but I too find the Grid is the same width as the original.
When I try...
rbf_getGridControlComponent(0).refresh();
I get the error:
Uncaught Refresh not supported for GridControl component.
If I should try...
rbf_getGridControlComponent(0).getKendoConfig().refresh();
The data source appears to be cleared and I'm left with no rows
Do you have another solution to achieve a refresh/resize?
Thanks
--
Charles
[Rollbase 4.5.2.0]
What happens if you do the following:
rbf_getGridControlComponent(0).getKendoConfig().dataSource.read();
My rows are cleared.
Sorry, I misunderstood your initial question (basically, how to resize the grid after removing columns).
You should check this link:
[View:https://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/Layout/auto-resize-grid-when-hiding-and-showing-columns:550:50]
So what you'll need to do is to calculate the total width of the current visible columns and that will be your new grid size.
And you'll be able to set the width of the grid (like they are doing in the example) in Rollbase using:
rbf_getGridControlComponent(0).getKendoConfig().wrapper.width(650);
Hello Ruben,
Thanks for the suggestions.
That latest has just narrowed the grid view and left the scroll unchanged
--
Charles.
After narrowing the grid, try calling the resize() method, I think that should update the scrollbar:
rbf_getGridControlComponent(0).getKendoConfig().resize();
Hello Ruben,
Yes, that works well.
Thanks
--
Charles.