Need More Info
Last Updated: 03 Jul 2023 07:56 by ADMIN
Bernd
Created on: 17 Jun 2023 09:01
Category: Form
Type: Feature Request
0
Add a way to convert a formitem to its templated version

I often have the scenario where I need to switch from the autogenerated formitem to a templated version. Mostly because I need a different editor

For example:

<FormItem Field="@nameof(KeyValuesViewModel.Workplace)" LabelText="Workplace" EditorType="@FormEditorType.TextBox"/>

I create something like this:

            <FormItem>
                <Template>
                    <label for="WorkplaceInput">Workplace</label>
                    <TelerikMaskedTextBox Id="WorkplaceInput" Mask="aa aaaaaa" Enabled=@WorkplaceEnabled OnChange="OnWorkplaceChanged" @ref=@WorkplaceTextBoxRef />
                    <TelerikValidationMessage For="@(() => KeyValuesViewModel.Workplace)" />
                </Template>
            </FormItem>

It would speed up things if I just could use the "light bulb" and convert it. Instead coding it manually, copy, paste, edit the copied version. Over and over again.

3 comments
ADMIN
Svetoslav Dimitrov
Posted on: 03 Jul 2023 07:56

Hello Bernd,

If in the general case, you need to modify certain editors to MaskedTextBoxes you can create a reusable template (or a few of these) and pass it to the FormItem's Template parameter. Here is a knowledge-based article that showcases the concept. The sample code is for the Grid, however, the same is applicable to all components that expose customizations through RenderFragments. 

Let me know if the knowledge-based article helps you achieve the desired behavior and if you have any further questions.

Regards,
Svetoslav Dimitrov
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.
Bernd
Posted on: 26 Jun 2023 10:02
Dear Svetoslav ,
thank you for your reply.

This "template generator" is only needed if I have to customize the form item. Which is very often the case. E.g. using a not supported editor type, needing more detailed access to the input or layout.

If you can't determine the editor type of the form item, just use a textbox. I customize the template anyways. For me it you don't have to put rocket sience intelligence into this generator.

Thinking about it. In most cases I need the masked textbox and an additional text showing the description for the entered value. The mask is used to have the same screen representation as the ERP system uses and the additional text is the name or description of the ERP object (employee, item, workplace, sales org, ...)

If I can solve this without using a template in the form the "template generator" would be obsolete.
ADMIN
Svetoslav Dimitrov
Posted on: 26 Jun 2023 05:49

Hello Bernd,

If I understood you correctly, you would like to use Visual Studio Intellisense to change the default editor of a form item. I would like to ask for your feedback on how would you suggest the interface would look. For example, in the provided code snippet you would like to use the MaskTextBox editor, however, VS is not aware of the data types. In case we introduce changing the Editor through Intellisense, in the popup you will see all available editors like NumericTextBox, DateInput, DatePicker, and DateTimePicker. This will make the popup huge. 

The solution I can see is that you use the EditorType parameter, available for the FormItem tag. This parameter allows you to change the default editor without the need for a Template. 

Regards,
Svetoslav Dimitrov
Progress Telerik

As of R2 2023, the default icon type will be SVG instead of Font. See this blogpost for more information.