Home > Development, VB .Net > Dynamic change color on a row of grid, based on some cell value

Dynamic change color on a row of grid, based on some cell value

January 21st, 2010 Leave a comment Go to comments

This is considered by some people as Holy Grail of Syteline Form Personalization.

Here is what we want to do.  In “Time Phased Inventory” form, we want to change the color to yellow for those rows that is PO.

First, we need to create a new form script method, called SetPOColor()

Sub SetPOColor()
Dim i as Integer
Dim j as Integer
Dim sReference As String
Dim sRef3 As String
Dim sRef4 As String
Dim oSupDem As IWSIDOCollection

oSupDem = ThisForm.PrimaryIDOCollection.GetSubCollection(“SLSupDems”, -1)
j = oSupDem.GetNumEntries

‘    MsgBox(“j = ” + CStr(j))

For i = 1 To j

sReference = ThisForm.Components(“SLSupDemsGrid”).GetGridValueByColumnName(i, “SLSupDemsReferenceSubGridCol”)

sRef3 = Mid(sReference, 1, 3)
sRef4 = Mid(sReference, 1, 4)
If sRef3 = “PO ” Or sRef4 = “XPO ” Then
ThisForm.Components(“SLSupDemsGrid”).SetGridRowColColor(i, 0, “255,255,0”, “”)
End If
Next i
ThisForm.Components(“SLSupDemsGrid”).ForceRepaint
End Sub

Secondly, we create a new event handler for event “StdObjectSelectCurrentCompleted”, to call the above form script method SetPOColor().

Done.  Now here we are:

  1. Cheryl
    January 7th, 2011 at 08:57 | #1

    Is this for SL8?

  2. admin
    January 7th, 2011 at 16:41 | #2

    Yes, that is in SL8. Not sure if it works in SL7. The key is the SetGridRowColColor method.

  1. No trackbacks yet.
You must be logged in to post a comment.