Как выровнять и обернуть слово в поле панели формы в ExtJS? - PullRequest
2 голосов
/ 17 декабря 2010

Как сделать поле многострочной формы Description перенос слов и выравнивание по верху его текст?

alt text

<script type="text/javascript">
    clearExtjsComponent(regionContent);
    var panel_form = new Ext.FormPanel({
        labelWidth: 100,
        frame:true,
        style: 'margin: 10px',
        title: 'Test Product ID#2',
        bodyStyle:'padding:5px 5px 0',
        width: 500,
        defaultType: 'textfield',

        items: [{
                fieldLabel: 'ID',
                value: '2',
                name: 'id',
                disabled: true,
                width: 370,
                style: 'text-align: right',
                name: 'id',
                disabled: true,
                width: 50,
            },{
                fieldLabel: 'Product',
                value: 'Envelope',
                name: 'product',
                width: 370,
            },{
                fieldLabel: 'Description',
                value: 'Having a good idea about the functional requirements and client-side technology choices, the next step was to decide how things were going to be on the server side. To channel all communications with my web client I decided to use an http handler. For the articles repository, a binary file would go very well with my simplicity and short-construction-time requirements. Any data access and business logic would be placed inside class libraries.',
                name: 'description',
                width: 370,
                height: 100,
            },{
                    ...

Когда я пытаюсь xtype: 'textArea', я получаю ошибку types[config.xtype || defaultType] is not a constructor:

        },{
            fieldLabel: 'Description',
            value: 'Having a good idea about the functional requirements and client-side technology choices, the next step was to decide how things were going to be on the server side. To channel all communications with my web client I decided to use an http handler. For the articles repository, a binary file would go very well with my simplicity and short-construction-time requirements. Any data access and business logic would be placed inside class libraries.',
            height: 100,
            xtype: 'textArea',
            name: 'description',
            width: 370,
        },{

1 Ответ

3 голосов
/ 17 декабря 2010

Вы изменили defaultType на 'textfield', то есть xtype, который вы хотите использовать во всех полях, кроме поля Описание.Для этого поля вы бы хотели xtype из 'textarea'.Это автоматически выровняет текст и перенос слов, как это делает обычная HTML-текстовая область.Имейте в виду, что с большим количеством текста вы, вероятно, увидите полосу прокрутки в области текста.Если вы хотите избежать использования полос прокрутки, взгляните на опции конфигурации TextArea grow, growMax и growMin.

Пример:

   {
       xtype: 'textarea',
       fieldLabel: 'Description',
       value: 'Having a good idea about the functional requirements and client-side technology choices, the next step was to decide how things were going to be on the server side. To channel all communications with my web client I decided to use an http handler. For the articles repository, a binary file would go very well with my simplicity and short-construction-time requirements. Any data access and business logic would be placed inside class libraries.',
       name: 'description',
       width: 370,
       height: 100,
    }
...