How to add Label to a dynamicForm.
Dynamic forms setItems method is not accepting Label type argument.
Can you tell which form item to use for rendering label on DynamicForm.
Indeed adding a label to a dynamic form is not something you can do.
A dynamicForm uses a number of FormItems to display the items in the form. When creating a FormItem you can use setTitle (or specify the title in the construction of a specific FormItem). Setting the title on a formItem results in a label related to the input field.
See http://www.smartclient.com/smartgwt/javadoc/com/smartgwt/client/widgets/form/fields/FormItem.html for more detail on which subclasses of are available for usage within a dynamic form.
If you just want a simple label without a corresponding form item, just create a new TextItem with a specific title and mark the textItem as disabled, this will suppress the textbox and only print out the title (aka label).
Greets,
David
Hi David.
Thanks for prompt reply.
But its not working out.
I used TextItem and set title for it and marked it disabled by using setDisabled(true).
It is showing both title and textbox in faided and disabled.
I want to see just label(title) that too not faided.
Attcahed image is what is coming.
Regards,
Munish
Try a StaticTextItem or even BlurbItem if you want it to use formatted HTML.
Mhh, indeed. Sorry, i forgot i had some custom CSS attached to my application which renders disabled fields a bit differently. A remainder of some old code, which is should actually remove ![]()
Like davidj6 suggested, the StaticTextItem is the way to go.
I have used StaticTextItem.
It worked…Thx.
Is it still impossible to add a label to a dynamic form? Can’t seem to find a clean way to do it.
