English 中文(简体)
如何读写和确定一个排在“ExtJS Grid”中的具体单元的价值?
原标题:How to read and set a value of a specific cell in an ExtJS Grid?
  • 时间:2010-03-15 13:27:09
  •  标签:
  • extjs
  • grid

I am beginning with ExtJS. I am trying to read a value from a cell that is selected
I use an EditorGrid and the store looking like that :

my_store = new Ext.data.JsonStore({
    root:  topics ,
    totalProperty:  totalCount ,
    idProperty:  details_id ,

    fields: [
        {name :  index ,    type :  int },
        {name :  inactive , type :  int },
        {name :  c_1 ,      type :  string },
        {name :  c_2 ,      type :  string },
        {name :  c_3 ,      type :  string },
        {name :  c_4 ,      type :  string }
    ],
    proxy: new Ext.data.ScriptTagProxy({
        url:  my_proxy_url 
    })
});

到目前为止,这是我用来检索选定牢房的浏览器和栏目:

var column = grid.getSelectionModel().selection.cell[0];
var row    = grid.getSelectionModel().selection.cell[1];

我怎么能够读到电网中某个选定电池的价值并改变这一价值?

最佳回答

这完全取决于你的甄选模式。 缩略语 您可以取得选定行文的记录,因此:

var sel_model = grid.getSelectionModel();
var record = sel_model.getSelection()[0];

那么,你们需要的是使用一套(......)方法:

record.set("c_1","Test");

当然,有<条码>EditorGridPanel,你改称编辑,以控制而不是直接编辑。

问题回答

@Llyod

您的答复

这完全取决于你的甄选模式。 缩略语 您可以取得选定行文的记录,因此:

var sel_model = grid.getSelectionModel();
var record = sel_model.getSelection()[0];

然后,你需要的是使用<代码>()方法:

record.set("c_1","Test");

当然,有一个主编GridPanel的编辑,你将重新编辑成控制,而不是直接编辑。

this works, But what if i want to accesses the value of cell by using column value (e.g. 4 or 5) instead of column name. Is it possible to do the same





相关问题
ExtJS load form items/fields from database

I am using ExtJS 3 here. I would like to populate a formpanel from database with fields to be submitted. Basically, I don t know witch fields my form will have and I want to generate all formpanel ...

How to use Ext JS for role based application

I am planning to use Ext JS for a large application. The application s features are role based. When user login, they only see menu and screen features related to them. My server side technology will ...

Dynamically adding a TabPanel to a Panel Region

I have a Panel layout with a TreePanel in one region. A user clicks on an node in the tree and a TabPanel should be displayed in another region with information, editing tools etc. for that tree node....

How to embed Json result within Extjs Panel?

I have some issues with Json result and embed it within the html of the Extjs Panel. Here s that I have managed to get so far. myPanel is embedded within a mainPanel, and I have some shows/hide of ...

Ajax data update. Extjs

I need to keep certain data ( in a grid) up to date and was gonna do a poll to the server every 15 seocnds or so to get the data and refresh the grid, however it feels a bit dirty ( the grid will have ...

Better way to call superclass method in ExtJS

All the ExtJS documentation and examples I have read suggest calling superclass methods like this: MyApp.MyPanel = Ext.extend(Ext.Panel, { initComponent: function() { // do something MyPanel ...

Merged Headers in Ext JS Grid

Is it possible to have two headers in Ext JS grids? I have to show my grid as grouped data.. for example product types and products. In my case I need a grid like this: Field | Product Type A ...

热门标签