Author Topic: How can i set disabled any checkbox and get row selected in the Tree grid  (Read 2722 times)

resolvecomputing

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 40
    • View Profile
Dear team
When i create tree grid i don't know how i can disabled and then a selected the root how can i get all seleted node in the tree in 2 case(the root closed or opened)

https://jsfiddle.net/linhluu/bh42c328/1/

Thanks you so much!

resolvecomputing

  • Pro Ultimate
  • Newbie
  • *
  • Posts: 40
    • View Profile
« Last Edit: January 31, 2018, 07:44:05 am by resolvecomputing »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
The checked rows can be found by iterating through data and finding rows which have pq_tree_cb: true

https://paramquery.com/pro/api#option-treeModel

Code: [Select]
  $('#getrow').click(function() {
    // get row is checked
    var selected = grid.getData().filter(function(rd) {
      return rd.pq_tree_cb;
    }).map(function(rd) {
      return rd.name;
    })
    alert(selected);
  });

https://plnkr.co/edit/yqQ66QNMr7ycBIB4wQOx?p=preview
« Last Edit: January 31, 2018, 10:36:08 am by paramquery »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: How can i set disabled any checkbox and get row selected in the Tree grid
« Reply #3 on: February 02, 2018, 07:43:17 pm »
You may ignore the previous code as there is also a straightforward API to get checked rows in a treegrid

Code: [Select]
var selected = grid.Tree().getCheckedNodes()

https://paramquery.com/pro/api#method-Tree
« Last Edit: February 02, 2018, 09:27:02 pm by paramquery »