Lee Rooy
Lee Rooy

Reputation: 141

how to build an extjs form from object defined in domain class

I have seen a grails domain class having something like this defined:

static formLayout =
    [   title:"New Patient Patient",
        layout: "custom",
        autoHeight:true,
        items:
        [
            [
                layout: 'column',
                labelWidth: 135,
                items:
                [[
                    columnWidth: 0.5,
                    layout: 'form',
                    items:["patientNo", "dob","surName"]
                ],[
                    columnWidth: 0.5,
                    layout: 'form',
                    items:["responsibleDoctor","givenName","sex.value"]
                ]]
            ],
...
]

All I want to know is how can this be used/called either from an extjs file or controller file so it appears as a form.

Upvotes: 0

Views: 91

Answers (1)

Alidad
Alidad

Reputation: 5538

This is not a common approach to have javaScript parameters defined in Domain classes for the consumption of the views.

However, Assuming that you are looking at a code base that applied such approach, if I am not mistaken the view that is consuming them is sending an ajax call to a controller and reads these values as JSON. I am not much familiar with extJs, but it should be able to consume parameters as JSON. For example, Ext.create has option url that hits the external source. If you are looking at a code base that is using this approach you should be able find the view and controller that is delivering and consuming it.

Upvotes: 1

Related Questions