PDA

View Full Version : [CLOSED] Form field which works like TemplateColumn in gridPanel



user2022
Sep 07, 2022, 4:57 PM
Hello,

I need to display data in the form panel just like the way the TemplateColumn work in grid panel, something like provide the template and can bind data from multiple field from the model, and if the form data value changed, this component need to be refreshed as well.

How can I achieve this.

Thanks in advance.

fabricio.murta
Sep 08, 2022, 3:38 PM
Hello @user2022!

I believe what you want is data binding (client side).

Take a look at this MVC example:

- Gridpanel > Data With Details > Binding (https://mvc5.ext.net/#/GridPanel_Data_with_Details/Binding/)

There are several other examples in WebForms you should be able to reuse in MVC.

- Simple static data binding example for reference (https://examples5.ext.net/#/Data_Binding/Basic/Hello_World/)
- Dynamic data binding (https://examples5.ext.net/#/Data_Binding/Basic/Dynamic/)
- Data binding formulas / transformations (https://examples5.ext.net/#/Data_Binding/Basic/Formulas/)
- Chained stores (https://examples5.ext.net/#/Data_Binding/Basic/Chaining_Stores/)

The sole MVC example above basically covers what should be needed to convert the WebForms example into an MVC one, yet depicts how to change value of generic components given a grid panel's selection.

So far we've taken into account only client-side data binding. That is, what data the server provided to the web browser can be linked altoghether allowing a dynamic user interaction with your application.

When you're talking about MVC models and binding though, there is another concept of binding: model binding. But the model is once provided by the server and won't necessarily change without a full server round-trip (direct event/method). Actually, the page model is only provided once at the time the page loads. Other than that, if I'm not mistaken, all you get are updates on the page or full page re-retrieval.

The model binding involves dedicated MVC components that help you fill component data with whatever the MVC model brings. For instance the following example shows how to build a form out of the page's model:

- Models > FormPanelFor (https://mvc5.ext.net/#/Models/FormPanelFor/)

But, say, in case you have another field in the form that uses the input for the Name field, you can still use client-side data binding as above to sync field values.

Hope this helps!

user2022
Sep 09, 2022, 5:14 PM
Hello @fabricio.murta,

Data binding (client side) works perfectly for my needs, thanks a lot for your help.
Please close this thread

fabricio.murta
Sep 14, 2022, 4:36 PM
Thanks for the feedback, and glad we could be of help!