Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular :1}, {'clientCode':2,'clientName':'client2','groupName':'groupA','assignmentId':0}, {'clientCode':3,'clientName':'client3','groupName':'groupA','assignmentId':1}, ]; 变量gridOption={ enableFilter:true, enableSorting:true, enableColResize:true, 分页:正确, 分页页面大小:5, 行选择:“多个”, suppressRowClickSelection:true, 行数据:数据, columnDefs:[ { 头名:'', 宽度:40, 是的, HeaderCheckBox选择:正确, HeaderCheckBox选择过滤器默认值:false, 复选框选择:true, }, {headerName:'Client Code',字段:'clientCode'}, {headerName:'Client Name',字段:'clientName'}, {headerName:'组名',字段:'组名'}, ], getRowStyle:函数(参数){ 如果(params.node.rowIndex%2==0){ 返回{background:'#dfffdf'} } }, onRowDataChanged:event=>{ event.api.forEachNode(函数(行节点,索引){ 如果(rowNode.data.assignmentId>0) rowNode.setSelected(true); }); } }; this.isRowSelectable=函数(行节点){ 返回rowNode.data?rowNode.data.year_Angular_Ag Grid - Fatal编程技术网

Angular :1}, {'clientCode':2,'clientName':'client2','groupName':'groupA','assignmentId':0}, {'clientCode':3,'clientName':'client3','groupName':'groupA','assignmentId':1}, ]; 变量gridOption={ enableFilter:true, enableSorting:true, enableColResize:true, 分页:正确, 分页页面大小:5, 行选择:“多个”, suppressRowClickSelection:true, 行数据:数据, columnDefs:[ { 头名:'', 宽度:40, 是的, HeaderCheckBox选择:正确, HeaderCheckBox选择过滤器默认值:false, 复选框选择:true, }, {headerName:'Client Code',字段:'clientCode'}, {headerName:'Client Name',字段:'clientName'}, {headerName:'组名',字段:'组名'}, ], getRowStyle:函数(参数){ 如果(params.node.rowIndex%2==0){ 返回{background:'#dfffdf'} } }, onRowDataChanged:event=>{ event.api.forEachNode(函数(行节点,索引){ 如果(rowNode.data.assignmentId>0) rowNode.setSelected(true); }); } }; this.isRowSelectable=函数(行节点){ 返回rowNode.data?rowNode.data.year

Angular :1}, {'clientCode':2,'clientName':'client2','groupName':'groupA','assignmentId':0}, {'clientCode':3,'clientName':'client3','groupName':'groupA','assignmentId':1}, ]; 变量gridOption={ enableFilter:true, enableSorting:true, enableColResize:true, 分页:正确, 分页页面大小:5, 行选择:“多个”, suppressRowClickSelection:true, 行数据:数据, columnDefs:[ { 头名:'', 宽度:40, 是的, HeaderCheckBox选择:正确, HeaderCheckBox选择过滤器默认值:false, 复选框选择:true, }, {headerName:'Client Code',字段:'clientCode'}, {headerName:'Client Name',字段:'clientName'}, {headerName:'组名',字段:'组名'}, ], getRowStyle:函数(参数){ 如果(params.node.rowIndex%2==0){ 返回{background:'#dfffdf'} } }, onRowDataChanged:event=>{ event.api.forEachNode(函数(行节点,索引){ 如果(rowNode.data.assignmentId>0) rowNode.setSelected(true); }); } }; this.isRowSelectable=函数(行节点){ 返回rowNode.data?rowNode.data.year,angular,ag-grid,Angular,Ag Grid,新来源的输出: 是的,这很好,但我想保留标题复选框,以便一次选中/取消选中所有行。您是否也可以添加标题复选框?我用新的源代码更新了答案。我希望你会喜欢。是的,这很好,但我想保留标题复选框,以便一次选中/取消选中所有行。您是否也可以添加标题复选框?我用新的源代码更新了答案。我希望它能帮助你。 this.gridClientOptions = { enableFilter: true, enableSorting: true, enableColResize: true, pag

新来源的输出:


是的,这很好,但我想保留标题复选框,以便一次选中/取消选中所有行。您是否也可以添加标题复选框?我用新的源代码更新了答案。我希望你会喜欢。是的,这很好,但我想保留标题复选框,以便一次选中/取消选中所有行。您是否也可以添加标题复选框?我用新的源代码更新了答案。我希望它能帮助你。
  this.gridClientOptions = {
  enableFilter: true,
  enableSorting: true,
  enableColResize: true,
  pagination: true,
  paginationPageSize: 5,
  rowSelection: 'multiple',
  suppressRowClickSelection: true,
  columnDefs: [
      {
        headerName: '',
        width: 40,
        headerCheckboxSelection: true,
        headerCheckboxSelectionFilteredOnly: true,
        checkboxSelection: true,
        cellRenderer: 'selectedClient'
    },
    {headerName: 'Client Code', field: 'clientCode'},
    {headerName: 'Client Name', field: 'clientName'},
    {headerName: 'Group Name', field: 'groupName'},
  ],
  components: {
    'selectedClient': this.selectedClient
  },
  getRowStyle: function(params) {
    if (params.node.rowIndex % 2 === 0) {
        return { background: '#dfffdf' }
    }
  }      
}

selectedClient(params) {
return params.data.assignmentId > 0 ? `<input type='checkbox' checked>` : `<input type='checkbox'>`;
  }
var data = [
  {'clientCode':1,'clientName':'client1', 'groupName' : 'groupA', 'assignmentId':1},
  {'clientCode':2,'clientName':'client2', 'groupName' : 'groupA', 'assignmentId':0},
  {'clientCode':3,'clientName':'client3', 'groupName' : 'groupA', 'assignmentId':1},
  ];

var gridOption = {
  enableFilter: true,
  enableSorting: true,
  enableColResize: true,
  pagination: true,
  paginationPageSize: 5,
  rowSelection: 'multiple',
  suppressRowClickSelection: true,
  rowData: data,
  columnDefs: [
      {
        headerName: '',
        width: 40,
        editable: true,
        cellRenderer: params => {
          return `<input type='checkbox' ${params.value ? 'checked' : ''} />`;
        },
        field: 'assignmentId'
    },
    {headerName: 'Client Code', field: 'clientCode'},
    {headerName: 'Client Name', field: 'clientName'},
    {headerName: 'Group Name', field: 'groupName'},
  ],
  getRowStyle: function(params) {
    if (params.node.rowIndex % 2 === 0) {
        return { background: '#dfffdf' }
    }
  }      
};


var mygrid = new agGrid.Grid(document.querySelector('#myGrid'),gridOption);
var data = [
  {'clientCode':1,'clientName':'client1', 'groupName' : 'groupA', 'assignmentId':1},
  {'clientCode':2,'clientName':'client2', 'groupName' : 'groupA', 'assignmentId':0},
  {'clientCode':3,'clientName':'client3', 'groupName' : 'groupA', 'assignmentId':1},
  ];

var gridOption = {
  enableFilter: true,
  enableSorting: true,
  enableColResize: true,
  pagination: true,
  paginationPageSize: 5,
  rowSelection: 'multiple',
  suppressRowClickSelection: true,
  rowData: data,
  columnDefs: [
      {
        headerName: '',
        width: 40,
        editable: true,
        headerCheckboxSelection: true,
        headerCheckboxSelectionFilteredOnly: false,        
        checkboxSelection: true,
    },
    {headerName: 'Client Code', field: 'clientCode'},
    {headerName: 'Client Name', field: 'clientName'},
    {headerName: 'Group Name', field: 'groupName'},
  ],
  getRowStyle: function(params) {
    if (params.node.rowIndex % 2 === 0) {
        return { background: '#dfffdf' }
    }
  },
  onRowDataChanged: event => {
    event.api.forEachNode( function(rowNode, index) {
      if(rowNode.data.assignmentId > 0)
        rowNode.setSelected(true);
    });
  } 
};
this.isRowSelectable = function(rowNode) {
      return rowNode.data ? rowNode.data.year < 2007 : false;
    };

var mygrid = new agGrid.Grid(document.querySelector('#myGrid'),gridOption);