How to define custom SQL expression editor for Expression and Criteria grid columns? (ASP.NET Edition)
Last modified:
The UseCustomExpressionBuilder property prescribes to display the Edit button next to the Expression and/or Condition columns of the Grid control. Acceptable values are "None", "ExpressionColumn", "ConditionColumns", and "AllColumns". You should handle the GridBeforeCustomEditCell event to display the editor.
The sample is below.
QB.Web.Application.Grid.on( QB.Web.Grid.Events.GridBeforeCustomEditCell, function (e, obj) { var columnType = obj.columnType; // type of column: MetaData.FieldParamType enum var cell = obj.cell; // link to the edited grid cell var row = obj.row; // link to the edited grid row var value = obj.value; // current cell value // ... // set the new value by calling the cell.updateValue( newValue ) method });
The validateCondition and validateExpression methods have let validate values for the Expression and Condition grid cells.
The code samples are below.
QB.Web.Application.validateCondition(conditionValue, function(isValid, error) { /* isValid - boolean, error - error description if conditionValue is not valid */ });
QB.Web.Application.validateExpression(expressionValue, function(isValid, error) { /* isValid - boolean, error - error description if expressionValue is not valid */ });