function ListOptions_Rendered() {
$this->ListOptions->Items["send"]->Body = "<a href=\"#\" onclick=\"return ew.submitAction(event, {action: 'send', method: 'ajax', msg: 'Akan mengirim Kedivision Head?', key: " . $this->KeyToJson(TRUE) . "});\">Kirim</a>";
$this->ListOptions->Items["approve"]->Body = "<a href=\"#\" onclick=\"return ew.submitAction(event, {action: 'approve', method: 'ajax', msg: 'Yakin Akan Approve?', key: " . $this->KeyToJson(TRUE) . "});\">Approve</a>";
}
function Row_CustomAction($action, $row) {
$username = CurrentUserName();
$datetime = CurrentDateTime();
if ($action == "send") { // Check action name
$rsnew = ["status" => "send","aktorsend" => "$username","senddate" => "$datetime"]; // Array of field(s) to be updated
$result = $this->update($rsnew, "id = $row[id]"); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
if (!$result) { // Failure
$this->setFailureMessage("Failed to Send, ID = " . $row["id"]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage("Berhasil Send Ke Division Head.");
}
return TRUE; // Success
}
elseif ($action == "approve") { // Check action name
$rsnew = ["status" => "approve","appaktor" => "$username","appdate" => "$datetime"]; // Array of field(s) to be updated
$result = $this->update($rsnew, "id = $row[id]"); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
if (!$result) { // Failure
$this->setFailureMessage("Failed to Send, ID = " . $row["id"]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage("Berhasil Approve.");
}
return TRUE; // Success
}
}
im test on Page_Load:
function Page_Load() {
$this->CustomActions["send"]= new ListAction("send", "send", IsLoggedIn(),
ACTION_POSTBACK, ACTION_SINGLE);
}
not working
I need an automatic redirect to the list page again so that the changed data is visible. What server should I add to the event server? thank you
ok thanks.
oh yes is it possible. the message notif is changed to an input form by filling in the reason. for example, when the approve is clicked out of the popup with only one input page after being filled, proceed to the update … if possible, does php maker already provide the event? if there can I be helped? if not yet on the server event can I apply this logic? Thank you very much…
function ListOptions_Load() {
$item = &$this->ListOptions->Add("send");
$item->Header = "Kirim"; // Set the column header (for List page)
$item->OnLeft = TRUE; // Link on left
$item->MoveTo(0);
}
function ListOptions_Rendered() {
$this->ListOptions->Items["send"]->Body = "<button><a href=\"#\" onclick=\"return ew.submitAction(event, {action: 'send', method: 'post', msg: 'Akan mengirim Kedivision Head?', key: " . $this->KeyToJson(TRUE) . "});\">Kirim</button></a>";}
if ($action == "send") { // Check action name
$rsnew = ["status" => "send","aktorsend" => "$username","senddate" => "$datetime"]; // Array of field(s) to be updated
$result = $this->update($rsnew, "id = $row[id]"); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
if (!$result) { // Failure
$this->setFailureMessage("Failed to Send, ID = " . $row["id"]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage("Berhasil Send Ke Division Head.");
}
return TRUE; // Success
}
how to change the popup text.
become the input form. Reason (input text and post updates in the table) can anyone help?
To sent data you may use “data” property, according to source code:
@param {Object} args.data - Object of user data that is sent to the server
e.g. ew.submitAction(event, {action: ‘reject’, method: ‘post’, data: { reason: ‘some reason’ }, …})
Then in the Row_CustomAction on the server side you may get back the reason by $_POST[“reason”] and write your code to handle it.