我如何根据选中的条件(刻度线)显示网格 [英] I how to display grid based on condition with checked selected (tick mark)

查看:134
本文介绍了我如何根据选中的条件(刻度线)显示网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在html页面中,我正在显示下拉列表,下拉列表中的项目是动态的,并且在下拉列表下方显示带有复选框的ng-grid数据,这些复选框也是动态的,动态下拉列表具有json数据

In html page i am displaying the drop down ,the item in the drop down are dynamic ,and below the drop down displaying the ng-grid data with check boxes these are also dynamic ,the dynamic drop down has the j son data as

[
  {
    "c": "D",
    "l": 1,
    "cId": 1
  },
  {
    "c": "J",
    "l": 2,
    "cId": 3
  },
  {
    "c": "G",
    "l": 3,
    "cId": 1
  }
]

在下拉菜单中,我仅显示了属性"c" value. 动态网格的动态儿子数据为

In drop down i have displayed only property "c" value . The dynamic grid had dynamic j son data as

 [
  {
    "c": "U t",
    "cC": "Ut",
    "cId": 1
  },
  {
    "c": "Ca",
    "cC": "CA",
    "cId": 2
  },
  {
    "c": "U i",
    "cC": "MN",
    "cId": 3
  }
{
    "c": "U i",
    "cC": "MN",
    "cId": 4
  }
{
    "c": "U p",
    "cC": "Mz",
    "cId": 5
  }
{
    "c": "U r",
    "cC": "Mc",
    "cId": 6
  }
{
    "c": "U h",
    "cC": "Mj",
    "cId": 7
  }




]

在网格中,我仅显示vlaue "c":的属性 如果我在下拉列表中选择"c": "J",则"cId": 3

In grid i am showing only property of vlaue "c": If i select "c": "J" in drop down then if the "cId": 3 matched with cid of

"c": "U i",
"cC": "MN",
 "cId": 3 

其网格中的数据然后显示带有选中粗线选择标记的复选框的网格,并且如果下拉cId'中未选择的项目与网格匹配,则显示带有轻选择标记的复选框的网格

whose data in grid then display that grid with check box selected with thick select mark ,and also if the unselected items in the drop down cId's are match with grid then display the grid with check box selected with light select mark .

提交网格下方的按钮后,仅显示属性值"c":

After submit the button below the grid then display the only thick selected items of property value "c":

任何有关如何执行此操作和/或代码插入的想法都将不胜感激.谢谢!

any thoughts on how to do this and/or a code plunkers would be greatly appreciate. Thanks!

推荐答案

因此您需要在gridOptions中指定primaryKey字段...

so you need to specify primaryKey field in gridOptions...

$scope.myData = [{name: "Moroni", age: 50, id: 101},
                 {name: "Tiancum", age: 43, id: 102},
                 {name: "Jacob", age: 27, id: 103},
                 {name: "Nephi", age: 29, id: 104},
                 {name: "Enos", age: 34, id: 105}];
$scope.gridOptions ={
    data: 'myData',
    primaryKey: 'id'
}

这篇关于我如何根据选中的条件(刻度线)显示网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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