简体   繁体   English

如何在Ext.js 4.2.0中过滤网格上的渲染列

[英]How can I filter a rendered column on a grid in Ext.js 4.2.0

I have a column on my grid that is rendered based on the selected language. 我的网格上有一列是根据所选语言呈现的。 When I filter this column I can only find results based on the original language. 过滤此列时,只能找到基于原始语言的结果。 How can I make the filtering work for people with a different language? 如何使过滤功能适用于使用其他语言的人?

My code for the column looks like this now: (for example: labels.statusDraft is the dynamic name for draft in the selected language) 我的专栏代码现在看起来像这样:(例如:labels.statusDraft是所选语言的草稿的动态名称)

{
  text: labels.Status,
  width: 100,
  sortable: true,
  dataIndex: 'btStatus',
  filterable: true,
  field: {xtype: 'textfield'},              
  renderer: function(value){
            switch(value){
            case 'draft':
              status=labels.statusDraft;
              break;
            case 'approvalRequested':
              status=labels.statusApprovalRequested;
              break;
            case 'approved':
              status=labels.statusApproved;
              break;
            case 'rejected':
              status=labels.statusRejected;
              break;
            case 'archived':
              status=labels.statusArchived;
              break;
            default:
              status= value;
            };
            return status;
            }               
},  

The filter in the column can only filter the information which is fed to it in the data. 列中的过滤器只能过滤数据中提供给它的信息。

If you are storing a single value in the notes document and displayed the translation value to a customer on the XPage you just need to do a similar thing to your data source. 如果要在注释文档中存储单个值并在XPage上向客户显示转换值,则只需对数据源执行类似的操作。

Assuming you are using an ExtLib REST service to provide the data (or if you are doing it yourself it is still applicable) what you need to do it create a hand made column in the REST service and do the translation before the data is sent out. 假设您正在使用ExtLib REST服务来提供数据(或者如果您自己进行操作,它仍然适用),您需要执行的操作将在REST服务中创建一个手工制作的列,并在发送数据之前进行翻译。

In a case like this you need to store an aliased version of the "Status" in the database and not just the original language value. 在这种情况下,您需要在数据库中存储“状态”的别名版本,而不仅仅是原始语言值。 That will then allow you to do a translation on the fly like this. 这样,您就可以像这样即时翻译。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM