【问题标题】:Get value from select record in store从商店中的选择记录中获取价值
【发布时间】:2014-08-29 20:42:24
【问题描述】:

您好,我有商店,我想从这家商店获得 ID 字段中的值。

Ext.ComponentQuery.query('price gridpicker[name=price]')[0].store.getAt(0).data.id;

But this output only ID from first record in store, and when select other record I will still get ID from first record, help me thanks

【问题讨论】:

    标签: extjs store


    【解决方案1】:

    如果要获取选中的记录,则需要查询grid,而不是商店。商店只包含数据,它不知道屏幕上发生了什么。

    Ext.ComponentQuery.query('price gridpicker[name=price]')[0].getGrid().getSelectionModel().getSelection()[0].get('id');

    【讨论】:

      【解决方案2】:

      正确的调用是:

      ...getAt(0).get('id);
      

      或者,如果你想要所有记录的数据,那么

      ...getAt(0).getData();
      

      当然,您也可以获取其他值,但您需要知道gridpicker 选择了哪条记录。

      【讨论】:

        猜你喜欢
        • 2020-10-09
        • 2015-05-18
        • 2020-08-18
        • 2017-02-24
        • 2021-10-21
        • 1970-01-01
        • 2021-06-16
        • 2011-01-02
        • 2011-12-01
        相关资源
        最近更新 更多