ChexkBoxFormatter #5768
Unanswered
havvanur160401046
asked this question in
Help
Replies: 2 comments 11 replies
-
I'm not sure what you're trying to achieve here? Try search for |
Beta Was this translation helpful? Give feedback.
3 replies
-
@havvanur160401046 private booleantFormatter(ctx) {
var klass = 'edit check-box';
var item = ctx.item as ConfigurationRow;
var pending = this.pendingChanges[item.Id];
if (pending && pending[ctx.column.field] !== undefined) {
klass += ' dirty';
}
var value = this.getEffectiveValue(item, ctx.column.field) as string;
var check: string;
var isChecked = q.ToBool(value);
if (isChecked)
check = "<input type='checkbox' checked='" + isChecked + "' class='" + klass +
"' data-field='" + ctx.column.field +
"' value='" + value + "'/>";
else
check = "<input type='checkbox' class='" + klass +
"' data-field='" + ctx.column.field +
"' value='" + value + "'/>";
return check
} protected getColumns() {
var columns = super.getColumns();
let xyzColumn = Q.first(columns, x => x.field == fld.xyz);
xyzColumn .format = ctx =>
return this.booleantFormatter(ctx);
return columns;
} private inputsChange(e: JQueryEventObject) {
var cell = this.slickGrid.getCellFromEvent(e);
var item = this.itemAt(cell.row);
var input = $(e.target);
var field = input.data('field');
var text = Q.coalesce(Q.trimToNull(input.val()), '0');
var pending = this.pendingChanges[item.Id];
var effective = this.getEffectiveValue(item, field);
var oldText: string;
var value;
if (!pending) {
this.pendingChanges[item.Id] = pending = {};
}
if (input.hasClass('check-box')) {
if (item.Value == "False") {
value = "True";
input.prop("checked");
}
else {
value = "False";
input.prop("");
}
}
pending[field] = value;
item[field] = value;
this.view.updateItem(item.Id, item);
this.view.refresh();
input.val(value).addClass('dirty');
} in Constructor this.slickContainer.on('change', '.edit:input', (e) => this.inputsChange(e)); I have trimmed down the code by removing other validation for my specific code.. Please try and let me know.. you may need to alter some functions as per your needs |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I also want to change the checkbox over the list, I need to write a checkboxformatter function, but I have no idea how to do it, there is an example for the texts above, I think it should be like this as far as I understand
I did it like this, but what are my mistakes or deficiencies?
Beta Was this translation helpful? Give feedback.
All reactions