Extjs从数据库获取Id并将其传递给组件(Extjs Get Id from database and pass it to component)

编程入门 行业动态 更新时间:2024-10-28 13:22:38
Extjs从数据库获取Id并将其传递给组件(Extjs Get Id from database and pass it to component)

我面临的问题是。 我有一个查询数据库并获取汽车信息的表单,我想获得该数据的唯一ID并将其传递给已经制作的组件。

layout : 'fit', items : [{ xtype: 'cargrid', autoScroll: true //here I want the ID to be passed to this cone }]

Problem I am facing is. I have a form that query the database and get information on cars, I would like to get the Unique Id of that data and pass it to an already made component.

layout : 'fit', items : [{ xtype: 'cargrid', autoScroll: true //here I want the ID to be passed to this cone }]

最满意答案

也许,你想要在网格上显示行的ID吗?

你需要在商店/模型上得到它。 在数据存储上定义一个“id”字段。

模型:

fields: [ {name: 'idRow'}, {...} ] 在网格上,在dataIndex上定义一个列,其名称为“store field id”:

网格视图:

columns: [{ header: "Identificator", dataIndex: 'idRow' }, {...} ]

编辑:

如果你想覆盖de ID:

请参阅链接所属: itemID

并在评论中:(复制和粘贴)

例:

var c = new Ext.panel.Panel({ // height: 300, renderTo: document.body, layout: 'auto', items: [ { itemId: 'p1', title: 'Panel 1', height: 150 }, { itemId: 'p2', title: 'Panel 2', height: 150 } ] }) p1 = c.getComponent('p1'); // not the same as Ext.getCmp() p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling

评论:

Ext.apply(c, { itemId : 'p3' }

Maybe, did u want to show the id of the row on the grid ?

You need to get it on the store/model. Define one 'id' field on the data store.

MODEL:

fields: [ {name: 'idRow'}, {...} ] On the grid, define one column, with same name of "store field id" on the dataIndex:

GRID VIEW:

columns: [{ header: "Identificator", dataIndex: 'idRow' }, {...} ]

EDIT:

If you want overwrite de ID:

See the link belong: itemID

and in the comment: (copy&paste)

Example:

var c = new Ext.panel.Panel({ // height: 300, renderTo: document.body, layout: 'auto', items: [ { itemId: 'p1', title: 'Panel 1', height: 150 }, { itemId: 'p2', title: 'Panel 2', height: 150 } ] }) p1 = c.getComponent('p1'); // not the same as Ext.getCmp() p2 = p1.ownerCt.getComponent('p2'); // reference via a sibling

Comment:

Ext.apply(c, { itemId : 'p3' }

更多推荐

本文发布于:2023-07-15 22:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1119408.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组件   数据库   并将其   Id   Extjs

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!