I'm working on a bulk edit feature for ListGrids. I want to let the user select multiple rows in the grid and then present the editable grid fields in a form, showing the value from the first of the selected rows. The user can then edit the form fields and click an OK button to apply the form values to all selected grid rows.
When I create the FormItems I'm cloning the ListGridField using FormItem item = new FormItem(listGridField.getJsObj()). This seems to do the trick nicely. Even grid fields that are SelectItems with customized pick list criteria are cloned to be identical form items.
The only downside I've seen so far is that the FormItem also inherits the width and alignment of the ListGrid column. In most cases this is OK, but often the grid column is narrower than it should be and I want to make the FormItem wider. Also alignment in some columns has been set to "right" which causes the FormItem to be right-aligned in the form.
If I change the FormItem alignment it also changes the ListGridField alignment. So I suspect my "cloning" is not actually resulting in a new jsObj after all.
Is there a better way to clone a ListGridField to create a *new* FormItem?
When I create the FormItems I'm cloning the ListGridField using FormItem item = new FormItem(listGridField.getJsObj()). This seems to do the trick nicely. Even grid fields that are SelectItems with customized pick list criteria are cloned to be identical form items.
The only downside I've seen so far is that the FormItem also inherits the width and alignment of the ListGrid column. In most cases this is OK, but often the grid column is narrower than it should be and I want to make the FormItem wider. Also alignment in some columns has been set to "right" which causes the FormItem to be right-aligned in the form.
If I change the FormItem alignment it also changes the ListGridField alignment. So I suspect my "cloning" is not actually resulting in a new jsObj after all.
Is there a better way to clone a ListGridField to create a *new* FormItem?
Comment