回复 1楼风雨的帖子
从目前来看,当隐藏列的时候,在前台该行数据是不会渲染。
通过Selection获取行数据的时候,隐藏列不会获取。
所以考虑通过命令的方式获取改行的数据。比如点击按钮,就会弹出本行相关列的数据。但我未对隐藏该列后是否可以获取数据做验证。
示例:http://wijmo.gcpowertools.com.cn ... sample=含有命令的列
代码:- <script id="scriptInit" type="text/javascript">
- require(["wijmo.wijgrid"], function () {
- $(document).ready(function () {
-
- // bind the grid
- $("#demo").wijgrid({
- allowKeyboardNavigation: false,
- highlightCurrentCell: false,
- selectionMode: "none",
- allowSorting: true,
- data: getData(12),
- columnsAutogenerationMode: "none",
- columns: [
- {
- headerText: "link",
- buttonType: "link",
- command: {
- text: "Show contry",
- click: onCommandInfoClick
- }
- },
- {
- headerText: "button",
- buttonType: "button",
- command: {
- text: "Show country",
- click: onCommandInfoClick
- }
- },
- {
- headerText: "imageButton",
- buttonType: "imageButton",
- command: {
- text: "Show country",
- iconClass: "ui-icon-info",
- click: onCommandInfoClick
- }
- },
- {
- headerText: "image",
- buttonType: "image",
- command: {
- iconClass: "ui-icon-info",
- click: onCommandInfoClick
- }
- },
- { dataKey: "Country", headerText: "Country", dataType: "string" },
- { dataKey: "ProductName", headerText: "Product Name", dataType: "string" },
- { dataKey: "UnitPrice", headerText: "Unit Price", dataType: "currency" },
- ]
- });
-
-
- function onCommandInfoClick(e, args) {
- alert("Country: " + args.row.data.Country);
- }
-
- });
- });
-
-
- // random data generators
- function getData(count) {
- var data = [];
- var country = "USA,UK,Germany,Italy,Japan,Brazil,Canada".split(",");
- var name = "Lorem,Ipsum,Dolor,Amet,Consectetur".split(",");
- var suffix = "LLC,Inc".split(",");
- for (var i = 0; i < count; i++) {
- data.push({
- TransactionID: i,
- Country: getString(country),
- ProductName: getString(name) + " " + getString(suffix),
- UnitPrice: Math.floor(getNumber(5, 10)),
- Quantity: Math.floor(getNumber(1, 5)) * 10,
- Discount: getNumber(0, 0.3),
- OrderDate: getDate(i),
- Overseas: Math.random() > 0.8
- });
- }
- return data;
- }
- function getString(arr) {
- return arr[Math.floor((Math.random() * arr.length))];
- }
- function getNumber(lo, hi) {
- return lo + Math.random() * (hi - lo);
- }
- function getDate(daysAgo) {
- return new Date((new Date()).getTime() - daysAgo * 24 * 3600 * 1000);
- }
- </script>
-
-
-
- <div class="container">
- <div class="header">
- <h2>Editing</h2>
- </div>
-
- <div class="main demo">
- <!-- Begin demo markup -->
- <table id="demo">
- </table>
- <!-- End demo markup -->
-
- <div class="demo-options">
- <!-- Begin options markup -->
- <!-- End options markup -->
- </div>
- </div>
- <div class="footer demo-description">
- <p>
- 这个例子演示了如何使用含有命令的列。
- </p>
- </div>
- </div>
复制代码
下一步我们会尝试将Country列隐藏掉,然后是否还能够得到数据。如果有结果,会立即给你反馈。 |