Grid custom checkbox column
I am adding some custom columns programmatically ... all working well. The following code:
Produces:
This approach uses UserDefinedString1/UserDefinedString2/UserDefinedString3. There is no UserDefinedCheckbox1 ... is there a way I can jump in with grid event handlers of something to overide the grid display and show a checkbox, and then set UserDefinedString2 (in this case) to "True" or "False" ...
- Code: Select all
Private Sub ShowLedgerNumberColumn(activeSheet As Sheet)
Dim xmlString = activeSheet.GenerateXMLDefinition()
Dim xmlDocument = New XmlDocument
xmlDocument.LoadXml(xmlString)
Dim listOfColumns As XmlElement = xmlDocument.SelectSingleNode("JiwaGridDefinition/ListOfColumns")
If listOfColumns Is Nothing Then Return
Dim updated = ShowColumnAs(listOfColumns, "UserDefinedString1", "Ledger Number")
updated = updated Or ShowColumnAs(listOfColumns, "UserDefinedString2", "Receipt")
updated = updated Or ShowColumnAs(listOfColumns, "UserDefinedString3", "Creditor Purchase")
If updated Then activeSheet.ApplyXMLDefinition(xmlDocument.OuterXml)
End Sub
Private Function ShowColumnAs(listOfColumns As XmlElement, key As String, caption As String) As Boolean
For Each column As XmlElement In From col As XmlElement In listOfColumns.ChildNodes Where col.SelectSingleNode("Key").FirstChild().Value = key
If column.SelectSingleNode("Caption").FirstChild().Value = caption And column.SelectSingleNode("Hidden").FirstChild().Value = "0" Then Return False
column.SelectSingleNode("Caption").FirstChild().Value = caption
column.SelectSingleNode("Hidden").FirstChild().Value = "0"
Return True
Next
Return False
End Function
Produces:
This approach uses UserDefinedString1/UserDefinedString2/UserDefinedString3. There is no UserDefinedCheckbox1 ... is there a way I can jump in with grid event handlers of something to overide the grid display and show a checkbox, and then set UserDefinedString2 (in this case) to "True" or "False" ...