How have some logic inside the jquery Grid for showing buttons
I have a Grid in jquery, I need to have some logic in buttons that are inside the jqery cells taht I am not sure how write the if/statement inside that. This is where bind the grid:
function bindUser(result) { var deleteButtonHandler = function (arg) { var recordToDelete = ajaxresult[$(this).val()]; deleteRecord = recordToDelete; $("#deleteUser").html(recordToDelete.FullName); $(".modal-delete").show(); return; } var editButtonHandler = function (arg) { if(search === true) { bindEdit(searchResult[$(this).val()]); } else { bindEdit(ajaxresult[$(this).val()]); } $(".modal").show(); return; } var gridButtonConfig = { enable: true, buttons: [ { text: "Edit", clickHandle: editButtonHandler }, { text: "Delete", clickHandle: deleteButtonHandler } ] }; result.headerColumns = ["Email", "FullName", "Organization", "Department", "Access", "CreateDate", "Status", "Actions"]; result.headerLables = ["User Name / Email ", "Full Name", "Organization", "Department", "Access", "Created Date", "Status", "Actions"]; $("#Grid").myGrid({ data: result, width: "99%", enableSort: true, gridButton: gridButtonConfig }); }
In this part:
var gridButtonConfig = { enable: true, buttons: [ { text: "Edit", clickHandle: editButtonHandler }, { text: "Disable", clickHandle: deleteButtonHandler } ] };
I want to add(if(result.status==2)test: Disable; else text:Enable