Tommyworker
2017-09-21T07:20:17Z
Hello Igor,
i viewed your example. I have 2 questions: in the example you add a node. Can you show how to add an node for a Node "under" the node(hope the screenshot helps). And in the least how to make a click an the plus of the node select/deselect all node childs?
regards Thomas
10TecCheckboxquestions.PNG

Click to View Image66 View(s)

Igor/10Tec
2017-09-21T11:21:48Z
Originally Posted by: Tommyworker 

Can you show how to add an node for a Node "under" the node(hope the screenshot helps).



To add sub-sub-sub-...-nodes, you simply specify the required hierarchy level with the Level property of the iGrid row object (iGRow). For instance, the Node 1-2 in the 3rd row has the hierarchical level of 2, and it can be created with this statement:

iGrid1.Rows[2].Level = 2;

Originally Posted by: Tommyworker 

how to make a click an the plus of the node select/deselect all node childs?



It's not clear what you meant. If you need to expand all nested nodes from code, you can do this by setting the Boolean iGRow.Expanded property of every node to True.

If you want to tick the checkmark, then simply enumerate all required rows and change the corresponding cell value in the column that contains the check boxes.
Tommyworker
2017-09-21T16:59:35Z
Hi Igor,
so good so fine. on witch event should i react. If i click on the checkbox it works fine...
But if i click in the plus button it runs also. what is my fault.
it should only work if i click on the check box, now i use the:

Private Sub IGrid1_CellClick(sender As Object, e As iGCellClickEventArgs) Handles IGrid1.CellClick
Dim i As Int32 = 0
Dim SetState As CheckState = sender.cells(e.RowIndex, 0).value

Select Case sender.rows(e.RowIndex).level
Case 1
If SetState = CheckState.Unchecked Then
sender.cells(e.RowIndex, 0).value = CheckState.Checked
i = e.RowIndex + 1
While sender.rows(i).level = 2 Or sender.rows(i).level = 3
sender.cells(i, 0).value = CheckState.Checked
i += 1
End While
Else
sender.cells(e.RowIndex, 0).value = CheckState.Unchecked
i = e.RowIndex + 1
While sender.rows(i).level = 2 Or sender.rows(i).level = 3
sender.cells(i, 0).value = CheckState.Unchecked
i += 1
End While
End If

and so on...
regards thomas
Igor/10Tec
2017-09-22T10:13:20Z
Frankly speaking, I do not see the whole logic of your app and may not understand completely what you want to implement. However, some tips are below.

First of all, if you want to use the CellClick event to do something when the user clicks the check boxes in the first column, you also need to analyze the e.ColIndex parameter of the event to check whether it is the first column (its index is zero).

Another way is to handle the AfterCommitEdit event for the cells in the first column. The check box states are linked to cell values, and if the user changes the state of a check box, the corresponding cell value is changed and you can handle this in AfterCommitEdit.

You can use other events to know what part of iGrid cell is clicked by the user. For instance, the CellMouseDown event provides you with the e.ElemControl parameter you can read to know whether the tree button is clicked.

And finally, iGrid triggers the BeforeRowStateChange and AfterRowStateChange event when a row is expanded or contracted. Maybe, these events may help you too.

Feel free to ask us more if I did not help to solve your problem.
Users browsing this topic