如何在第一列中使用标题而不是顶行中的常规标题? [英] How to have headers in first column instead of regular headers in top row?

查看:120
本文介绍了如何在第一列中使用标题而不是顶行中的常规标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通常,ExtJS将JSON转换为网格,考虑到属性转到顶部列,它们的数字是固定的。并且相应的值作为记录加载到行中。行数可能会根据Json中的记录而有所不同。

Generally, ExtJS renders the JSON into grid considering that properties go to top columns and their number is fixed. And the corresponding values are loaded in rows as records.Here number of rows may vary depending upon the records in Json.

但是,我的要求稍有变化。我想要属性去第一行和相应的列。这里列数可能会根据Json中的记录而有所不同。

But there is slight change in my requirement. I want the properties to go to first row and corresponding columns. Here number of columns may vary depending upon the records in Json.

我想呈现如下所示的东西:

I want to render something like depicted below :

+-----------------+------------+---------------+
|                 |  Column 1  |    Column 2   |
+------------------------------+---------------+
|  Row Header 1   |    ...     |               |
+------------------------------+---------------+
|  Row Header 2   |            |               |
+------------------------------+---------------+
|  Row Header 3   |            |               |
+----------------------------------------------+

我了解实现列标题的方式,还有很多文档可用。例如

I understand the way to achieve the column headers, there are lot of documentation available as well. e.g.

http://docs.sencha.com/extjs/4.2.3/extjs-build/examples/build/KitchenSink/ext-theme-neptune/#grouped -header-grid

我甚至使用这里描述的解决方案:

I even achieved this using solution described here :

如何获取ExtJs中的行标题功能

但是在这种情况下,JSON看起来不好看,似乎不可维护,因为当我们要添加记录时,我们需要为所有数组项添加另一个属性:

But in this case, JSON doesnt look good and not seem to be maintainable since when we want to add record, we need to add another property to all array items:

{ [  

  { prop1 : value,  prop2 : value },  
  { prop1 : value,  prop2 : value },

  // to add new record, we need to do below :

  { prop1 : value,  prop2 : value,  prop3 : value },  
  { prop1 : value,  prop2 : value,  prop3 : value }


] }

与添加数组不同具有固定属性的项目在常规ExtJS网格的情况下:

Unlike adding array item with fixed properties in case of regular ExtJS grid :

{ [  

  { prop1 : value,  prop2 : value },  
  { prop1 : value,  prop2 : value },

  // to add new record, we need to do below :

  { prop1 : value,  prop2 : value },  
  { prop1 : value,  prop2 : value },  

  { prop1 : value,  prop2 : value }


] }

要加载到网格中的数据是非常巨大的,不可预测的行。请允许我知道正确的方式来实现它并保持JSON文件的优化/可读性。

The Data to be loaded in grid is extremely huge and not predictable rows. Kindly let me know the proper way to achieve it and maintaining the JSON file optimized/readable fashion.

推荐答案

没有列的概念Ext中的标题,但是,您可以通过锁定网格实现类似的功能: http ://dev.sencha.com/ext/5.1.0/examples/kitchensink/#spreadsheet

There no concept of column headers in Ext, nevertheless, you can achieve similar functionality with locking grid: http://dev.sencha.com/ext/5.1.0/examples/kitchensink/#spreadsheet

这篇关于如何在第一列中使用标题而不是顶行中的常规标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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