如何在Extjs中将其渲染到网格之前修改字段 [英] How to modify fields before rendering it to the grid in Extjs

查看:238
本文介绍了如何在Extjs中将其渲染到网格之前修改字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须向商店中提取的数据附加一个值,然后将其转换为ExtJs中的网格。

I have to append a value to the data fetched from the store before rendering it to the grid in ExtJs.

请指导我实现上述功能。

Please guide me on achieving the above mentioned functionality.

目前,网格以下列方式填充:

Currently the grid is populated in the following manner:

Ext.define("MyApp.view.ShowDetails",{
    extend: 'Ext.grid.Panel',
    requires:['MyApp.store.MyStore'],
    store:'MyStore', 
    stateId: 'stateGrid',
    selType : 'checkboxmodel', 
    selModel : {
    mode : 'MULTI'
    }, 
    plugins : [Ext.create('Ext.grid.plugin.RowEditing', {
    clicksToEdit : 2
     })],

    defaultType: 'textfield',
     columns: [
              {
                  header: 'Userid',
                  width: 150,
                  dataIndex: 'uid',
          editor : 
                {
                    allowBlank : true
                }

              }, 
             ...


推荐答案

是的,可以在 MODEL

一个例子:

 {
            name: 'uid',
            type: 'string',
            convert: function (value, record) {
                if (!value)
                    return value+'D';
                else
                    return value;

            }
        },

这篇关于如何在Extjs中将其渲染到网格之前修改字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆