ExtJS:组合数据存储未加载到字段集中

发布于 2024-11-04 23:42:10 字数 4010 浏览 1 评论 0原文

我有一个字段集问题。该表单有一个下拉组合,其中包含用户可以选择的日期范围。日期位于 ArrayStore 中。如果我把它放在字段集之外,它就可以完美地工作。但是一旦进入字段集,它就不会加载数据。我也尝试过使用 JSON 存储,得到相同的结果。

这是代码:

{
    name:           'DateFieldSet',
    fieldLabel:     '',
    labelSeparator: ':',
    title:          'Choose a date range',
    collapsible:    false,
    autoHeight:     true,
    allowBlank:     true,
    items:          [
                        {
                            fieldLabel:         'Days in past',
                            hiddenName:         'DateRangeCombo',
                            store:              new Ext.data.ArrayStore({
                                                    id:         0,
                                                    fields:     [
                                                                    'rangeValue',
                                                                    'rangeDescription'
                                                    ],
                                                    data:       [
                                                                    [30, '30 days (04/04/2011 - 05/04/2011)'],
                                                                    [60, '60 days (03/05/2011 - 05/04/2011)'],
                                                                    [90, '90 days (02/03/2011 - 05/04/2011)'],
                                                                    [120, '120 days (01/04/2011 - 05/04/2011)'],
                                                                    [180, '180 days (11/05/2010 - 05/04/2011)'],
                                                                    [270, '270 days (08/07/2010 - 05/04/2011)'],
                                                                    [365, '1 year (05/04/2010 - 05/04/2011)']
                                                    ]
                            }),
                            displayField:       'rangeDescription',
                            valueField:         'rangeValue',
                            editable:           true,
                            triggerAction:      'all',
                            width:              150,
                            listeners:          {select:function() {var numberOfDays = ReportForm.form.findField('DateRangeCombo').getValue();var newDate = DateAdd('05/04/2011', 'D', (numberOfDays * -1)); ReportForm.form.findField('StartDate').setValue(newDate);}},
                            xtype:              'combo'
                        },
                        {
                            fieldLabel:         'Or specify your own:',
                            labelStyle:         'width: 100%; font-weight: bold; text-align: left; color: #15428b; font-size: 11px;',
                            labelSeparator:     '',
                            xtype:              'label'
                        },
                        {
                            fieldLabel:         'Start Date',
                            name:               'StartDate',
                            allowBlank:         true,
                            vtype:              '',
                            checked:            false,
                            value:              '04/04/2011',
                            xtype:              'datefield'
                        }, 
                        {
                            fieldLabel:         'End Date',
                            name:               'EndDate',
                            allowBlank:         true,
                            vtype:              '',
                            checked:            false,
                            value:              '05/04/2011',
                            xtype:              'datefield'
                        }
                    ],
    xtype:          'fieldset'
}

它对我来说看起来很正常。

编辑〜这是错误:

this.proxy 未定义

并不是说​​它有多大帮助。

I have a fieldset issue. The form has a dropdown combo with date ranges the user can select. The dates are in an ArrayStore. If I put it outside the fieldset, it works perfectly. But once inside the fieldset, it will not load the data. I've tried this with JSON stores as well, with the same result.

Here's the code:

{
    name:           'DateFieldSet',
    fieldLabel:     '',
    labelSeparator: ':',
    title:          'Choose a date range',
    collapsible:    false,
    autoHeight:     true,
    allowBlank:     true,
    items:          [
                        {
                            fieldLabel:         'Days in past',
                            hiddenName:         'DateRangeCombo',
                            store:              new Ext.data.ArrayStore({
                                                    id:         0,
                                                    fields:     [
                                                                    'rangeValue',
                                                                    'rangeDescription'
                                                    ],
                                                    data:       [
                                                                    [30, '30 days (04/04/2011 - 05/04/2011)'],
                                                                    [60, '60 days (03/05/2011 - 05/04/2011)'],
                                                                    [90, '90 days (02/03/2011 - 05/04/2011)'],
                                                                    [120, '120 days (01/04/2011 - 05/04/2011)'],
                                                                    [180, '180 days (11/05/2010 - 05/04/2011)'],
                                                                    [270, '270 days (08/07/2010 - 05/04/2011)'],
                                                                    [365, '1 year (05/04/2010 - 05/04/2011)']
                                                    ]
                            }),
                            displayField:       'rangeDescription',
                            valueField:         'rangeValue',
                            editable:           true,
                            triggerAction:      'all',
                            width:              150,
                            listeners:          {select:function() {var numberOfDays = ReportForm.form.findField('DateRangeCombo').getValue();var newDate = DateAdd('05/04/2011', 'D', (numberOfDays * -1)); ReportForm.form.findField('StartDate').setValue(newDate);}},
                            xtype:              'combo'
                        },
                        {
                            fieldLabel:         'Or specify your own:',
                            labelStyle:         'width: 100%; font-weight: bold; text-align: left; color: #15428b; font-size: 11px;',
                            labelSeparator:     '',
                            xtype:              'label'
                        },
                        {
                            fieldLabel:         'Start Date',
                            name:               'StartDate',
                            allowBlank:         true,
                            vtype:              '',
                            checked:            false,
                            value:              '04/04/2011',
                            xtype:              'datefield'
                        }, 
                        {
                            fieldLabel:         'End Date',
                            name:               'EndDate',
                            allowBlank:         true,
                            vtype:              '',
                            checked:            false,
                            value:              '05/04/2011',
                            xtype:              'datefield'
                        }
                    ],
    xtype:          'fieldset'
}

It looks perfectly normal to me.

EDIT ~ Here's the error:

this.proxy is undefined

Not that it helps much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

岁月无声 2024-11-11 23:42:10

你错过了 mode 配置..

{
    xtype: 'combo',
    store: new Ext.data.ArrayStore({
        fields: ['rangeValue', 'rangeDescription'],
        data: [
            [30, '30 days (04/04/2011 - 05/04/2011)'],
            [60, '60 days (03/05/2011 - 05/04/2011)'],
            [90, '90 days (02/03/2011 - 05/04/2011)'],
            [120, '120 days (01/04/2011 - 05/04/2011)'],
            [180, '180 days (11/05/2010 - 05/04/2011)'],
            [270, '270 days (08/07/2010 - 05/04/2011)'],
            [365, '1 year (05/04/2010 - 05/04/2011)']
        ]

    }),
    fieldLabel: 'Days in past',
    displayField: 'rangeDescription',
    valueField: 'rangeValue',

    typeAhead: true,
    mode: 'local',    // add this

    triggerAction: 'all',
    emptyText: 'Select date...',
    listeners: {
        select: function () {
            var numberOfDays = ReportForm.form.findField('DateRangeCombo').getValue();
            var newDate = DateAdd('05/04/2011', 'D', (numberOfDays * -1));
            ReportForm.form.findField('StartDate').setValue(newDate);
        }
    }
}

you miss mode config..

{
    xtype: 'combo',
    store: new Ext.data.ArrayStore({
        fields: ['rangeValue', 'rangeDescription'],
        data: [
            [30, '30 days (04/04/2011 - 05/04/2011)'],
            [60, '60 days (03/05/2011 - 05/04/2011)'],
            [90, '90 days (02/03/2011 - 05/04/2011)'],
            [120, '120 days (01/04/2011 - 05/04/2011)'],
            [180, '180 days (11/05/2010 - 05/04/2011)'],
            [270, '270 days (08/07/2010 - 05/04/2011)'],
            [365, '1 year (05/04/2010 - 05/04/2011)']
        ]

    }),
    fieldLabel: 'Days in past',
    displayField: 'rangeDescription',
    valueField: 'rangeValue',

    typeAhead: true,
    mode: 'local',    // add this

    triggerAction: 'all',
    emptyText: 'Select date...',
    listeners: {
        select: function () {
            var numberOfDays = ReportForm.form.findField('DateRangeCombo').getValue();
            var newDate = DateAdd('05/04/2011', 'D', (numberOfDays * -1));
            ReportForm.form.findField('StartDate').setValue(newDate);
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文