RecroGridOnClientRecCustomize Method

Customizing the record to be sent to the client.

Definition

Namespace: Recrovit.RecroGridFramework
Assembly: Recrovit.RecroGrid (in Recrovit.RecroGrid.dll) Version: 8.12.0.24.1213.1
C#
protected virtual void OnClientRecCustomize(
	RecroGridRGClientColumn[] clientRec,
	Dictionary<string, Object> options
)

Parameters

clientRec  RecroGridRGClientColumn
The client record.
options  DictionaryString, Object
The options.

Remarks

Here you can dynamically specify options for the record or columns using RecroGridRGOptionOptionKeysD, as well as modify the data and styles.

Example

C#
protected override void OnClientRecCustomize(RGClientColumn[] clientRec, Dictionary<string, object> options)
{
    //Data search based on the received parameters
    var id = clientRec.Single(r => r.Property.Alias == "BusinessEntityID").DbValue;
    for (int i = 0; i < clientRec.Length; i++)
    {
        switch (clientRec[i].Property.ColName)
        {
            case "Gender":
                switch (clientRec[i].DbValue.ToString())
                {
                    case "F":
                        //Adding a CSS class to the row of the entity
                        options["RGOD_CssClass"] = "yellow-background";
                        options[clientRec[i].ClientName] = new
                        {
                            //jQueri UI Tooltip
                            RGOD_Tooltip = "Female"
                        };
                        break;
                    case "M":
                        options[clientRec[i].ClientName] = new
                        {
                            //Setting the style for the field
                            RGOD_Style = "color:gray;font-style:italic;",
                            RGOD_Tooltip = "Male"
                        };
                        break;
                }
                break;

            case "JobTitle":
                options[clientRec[i].ClientName] = new
                {
                    //Setting attributes
                    RGOD_Attr = new
                    {
                        id = string.Format("id-{0}", id),
                        title = clientRec[i].DbValue.ToString()
                    }
                };
                break;

            case "SecureField":
                //Removing a field
                options[clientRec[i].ClientName] = new { RGOD_Remove = true };
                break;

            case "MaritalStatus":
                switch (clientRec[i].DbValue.ToString())
                {
                    case "M":
                        //Data modification
                        clientRec[i].Value = "Married";
                        break;
                    case "S":
                        clientRec[i].Value = "Single";
                        break;
                }
                break;

            case "Dyndata":
                //Specifies dynamic (data not present in the database query) data using a method
                clientRec[i].Value = GetDynData(id);
                break;
        }
    }
}
private object GetDynData(object id) { throw new NotImplementedException(); }

See Also