Hi,
I have a problem about the validation.
In my page, I write some js codes can let user copy records from an excel and paste these records in my
pggrid. One row or multiple rows at one time. And I will check the dataIndx to set corresponding value for
each column.
As our general way, when user edit a cell and input some value which met my validation, I will change the
cell border color and display the customized error message next to this cell. So I want to achieve the same
effect after my paste operation.
I add the following code when I set a value for a cell:
$("#grid_json").pqGrid( "editCell", { rowIndx: rowIndx + i, dataIndx: colModel[m].dataIndx} );
var isValid = $("#grid_json").pqGrid("isValid", { dataIndx: colModel[m].dataIndx, value: value}).valid;
if (!isValid) {
$("#grid_json").find(".pq-editor-focus").css({ "border-color": "red" });
return false;
}
First, I set this column as the edit model. Then like the general, I check this cell with the validation. By
this code, for example,
I create two new line in my gird
Copy two row records from my excel(one column has the invalid value.).
Paste them in my gird.
And the result is the invalid cell will highlight and display the error message. But other cell, the valid
value didn't set in cell.
Then I remove "return false;" this statement. And try the above steps again. The result is the valid value
can set for my grid, but the invalid cell is empty. It's the display value didn't display but the invalid set
for this cell. Then I enter edit model for this invalid cell and the invalid value can display with error
message.
So the effect I desired is when I paste records in grid, all the invalid cell can display error message. Is
that possible?
Thank you!