如何获取除主键之外的表列的值

时间:2021-11-05 14:20:34

For getting the value of the primary key of the selected row, we can use record.get('id') in extjs. How to get the values of other columns (Say, if I have a column named name or t_id). In my case when I alert record.get('id') it gives the exact value whereas alerting record.get('t_id') shows undefined.

为了获取所选行的主键值,我们可以在extjs中使用record.get('id')。如何获取其他列的值(例如,如果我有一个名为name或t_id的列)。在我的情况下,当我提醒record.get('id')时,它给出了确切的值,而警告record.get('t_id')显示未定义。

Thanks.

谢谢。

Update:

更新:

I am getting the result for record.get('name'). Only the foreign key t_id is not working.

我得到了record.get('name')的结果。只有外键t_id不起作用。

2 个解决方案

#1


1  

You need to check certain thing @ejo.

你需要检查某些东西@ejo。

1. As @Daemon said you need to check whether you had defined 't_id' in your store feilds or in model. 
2. Second, you need to check whether you are sending the 't_id' value from backend.
3. third, if you use grid.getview option, check whether that t_id has been mapped to grid.

The most important one, please post your code, so that we can able to find the problem.

最重要的一个,请发布您的代码,以便我们能够找到问题。

#2


0  

Yeah! The foreign keys in grid are always missing in my experience. Please try defining a hidden field for that foreign key(not tested yet):

是啊!在我的经验中,网格中的外键总是缺失。请尝试为该外键定义一个隐藏字段(尚未测试):

column :t_id do |c|
  c.hidden = true
end

#1


1  

You need to check certain thing @ejo.

你需要检查某些东西@ejo。

1. As @Daemon said you need to check whether you had defined 't_id' in your store feilds or in model. 
2. Second, you need to check whether you are sending the 't_id' value from backend.
3. third, if you use grid.getview option, check whether that t_id has been mapped to grid.

The most important one, please post your code, so that we can able to find the problem.

最重要的一个,请发布您的代码,以便我们能够找到问题。

#2


0  

Yeah! The foreign keys in grid are always missing in my experience. Please try defining a hidden field for that foreign key(not tested yet):

是啊!在我的经验中,网格中的外键总是缺失。请尝试为该外键定义一个隐藏字段(尚未测试):

column :t_id do |c|
  c.hidden = true
end