How To Remove Action Buttons From Posted Rows In Free Jqgrid Using Fontawesome Checkbox Formatter
Solution 1:
I'm not sure that I correctly understand your question. Probably you want just test whether the cell row.cells[iCol]
contained checked symbol (<i>
with the class fa-check-square-o
) or unckecked (<i>
with the fa-square-o
). You can just use unformatter. If you prefer low-level way like
isPosted = $(row.cells[iCol]).find(">span>div>input:checked").length > 0;
then you can use
isPosted = $(row.cells[iCol]).find("i").hasClass("fa-check-square-o");
instead.
UPDATED: One can use
var isPostedStr = $.unformat.call(this, row.cells[iCol],
{rowId: row.id, colModel: cm}, iCol);
if (cm.convertOnSave) {
isPosted = cm.convertOnSave.call(this, {
newValue: isPostedStr,
cm: cm,
oldValue: isPostedStr,
id: row.id,
//item: $grid.jqGrid("getLocalRow", row.id),
iCol: iCol
});
}
where I suppose that this
is equal to $grid[0]
and cm
is colModel[iCol]
. The returned value will be the string "true"
or "false"
and to have boolean variable you need convert it to true or false. To be exactly the returned value depend on editoptions.value
which one use. template: "booleanCheckboxFa"
uses editoptions: {value: "true:false", defaultValue: "false"}
. So the returned value are the string "true"
or "false"
. If you want to make clean conversion of results to Boolean I would recommend you to look at the code of convertOnSave. I included the call of cm.convertOnSave
in case if it exist. In common case one should initialize item
property of the row, but simple formatters like formatter: "checkboxFontAwesome4"
don't uses the value.
Post a Comment for "How To Remove Action Buttons From Posted Rows In Free Jqgrid Using Fontawesome Checkbox Formatter"