Skip to content

Commit

Permalink
Improve comments for AgGrid.field
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgallagher92 committed May 24, 2024
1 parent 30601f8 commit dd170b9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/AgGrid.fs
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,10 @@ type ColumnDef<'row, 'value> =
static member inline field(v: string) =
columnDefProp<'row, 'value> ("field" ==> v)

/// Usage: `ColumnDef.field _.FieldName` or `ColumnDef.field (fun x -> x.FieldName)`
static member inline field(f: 'row -> _) =
// usage: `AgGrid.field _.FirstName` or `AgGrid.field (fun x -> x.FirstName)`
// Result = "FirstName"
// Get everthing after first '.'
let idxOfFirstDot = (string f).IndexOf('.')
// `ColumnDef.field _.FirstName` and `ColumnDef.field (fun x -> x.FirstName)` both result in "FirstName".
let field = (string f).Substring(idxOfFirstDot + 1)
columnDefProp<'row, 'value> ("field" ==> field)

Expand Down

0 comments on commit dd170b9

Please sign in to comment.