Unofficial documentation for SalesLogix DataGrid Control

The datagrid control is very convenient by poorly documented. I had to dig into by trial and error.  I will keep adding my notes to this entry.

Properties

Sortablesee this post

Format String:  currency: $,0.00;-$,0.00. %.2m works for field only, not in footer.

EVENTS

OnEdited event:  this event is raised when your mouse leaves the in-place editor of a particular cell.  Please note that it does NOT really verify if the value was changed or not. It’s  more like a “on lose focus from the editor” event.  I had to use a database call to verify that:

sql = “select top 1 * from Cash_Projection_Cal where COI_Amount=” & Value & ” AND Cash_Projection_CalID='” & PrimaryKeyValue & “‘”
set rs = Conn.execute(sql)
if rs.EOF THEN ‘– number has really been changed

You can change the Value variable to be saved to database. So at this point, this value hasn’t been saved to database yet. Do not try to update this very field in database directly because it will confuse the datagrid in next refresh event.

Another implication is that since at this time the just-changed-value hasn’t been saved to database yet, if you need to update other table/fields in database you have to call DataGrid1.Refresh to force it to be saved to database first.

OnCustomDrawCell event:  this is the only place you can do conditional formatting. Since it’s called for each individual cell, if you want to highlight the row you have to do it for all the cells. That means if your condition check costs a DB call, you will have to call that multiple times, unless you have a variable to hold the last check result. This commands change the backgound and font color:

color = rgb( 225, 225, 0)

if Column.Caption = “Residual CV” THEN
dim v
v = Node.Values(4) ‘– 0-based index
if v <> “” THEN
if CDBL(v) < 0 THEN Fontcolor = rgb( 255, 0, 0)
end if
end if

Advertisements
This entry was posted in SalesLogix. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s