PDA

View Full Version : [CLOSED] CompositeField equivalent... FieldContainer is NOT a Field itself.



adrianot
Jun 20, 2012, 9:11 AM
Hi, we developed our own control in Ext.Net 1.3, the "DateTimeField". We implemented it as a CompositeField (Date + Time fields), and we created the client-side override for get/setValue() in order to make it work dispatching the value to the other internal fields (Date and Time).

Now we're trying to migrate to Ext.Net 2.0 and I saw that this can't be done easily with the FieldContainer. In fact, this new container is NOT a field itself.

Do you suggest re-writing this control as a new "Field" and applying this composition logic there? Do you have some hints on doing that?

Thank you!!

Daniil
Jun 20, 2012, 12:28 PM
Hi,

I think using FieldContainer instead of CompositeField would be best.

Here is some example of such component.
<Ext.NET 2 sources root>\Ext.Net\Build\Ext.Net\ux\calendar\src\form\field\ DateRange.js

There are the getValue and setValue methods defined.

adrianot
Jun 20, 2012, 1:27 PM
Hi,

I think using FieldContainer instead of CompositeField would be best.

Here is some example of such component.
<Ext.NET 2 sources root>\Ext.Net\Build\Ext.Net\ux\calendar\src\form\field\ DateRange.js

There are the getValue and setValue methods defined.

Thank you Daniil, this can be done, however I need to change my implementation.

Another question that is regarding the same issue. Since the component itself is NOT a field, does this impact somehow with the methods that deal with the "fields", for example to get/set form data?

Thank you again,
Cheers

Daniil
Jun 20, 2012, 6:16 PM
Well, it impacts.

FieldContainer has no Name property and no isFormField flag. So, it won't be considered as a field within the loadRecord method. But this method will go through the FieldContainer items to find fields.

The CheckboxGroup class can be an example of creating a "field" inheriting from FieldContainer.
http://docs.sencha.com/ext-js/4-1/#!/api/Ext.form.CheckboxGroup (http://docs.sencha.com/ext-js/4-1/#%21/api/Ext.form.CheckboxGroup)