display the send button on the list page. What server side should I use?
You may simply use “ListOptions_Load” and “ListOptions_Rendered” server event. Alternatively, you may simply use “Page_Load” and “Row_CustomAction”. It actually depends on how you will execute the code. For more info and example, please read “Server Events and Client Scripts” topic.
newbiephp wrote:
After that, when you click the Send button, update the status field and return
to the list page.
Both ways above should work that suits your needs.
what I mean is.
on framework lara… .
im create controller and function.
public function approve($id)
{
$req = RequestModel::find($id);
$req->update([‘status’ => “approved”,‘tgl_approved’ => now(),‘chiefstore’=>Auth::user()->name]);
$user = User::where(‘name’,$req->pelapor)->first();
return redirect(route(‘chiefstore.index’))->with(‘pesan’,‘berhasil di approved dan akan di tangani helpdesk’);
}
view.
its work.
\
\
I want to implement this logic in the phpmaker project.
what steps should be taken? thanks
ok im try on table
structure
id int
nama varchar
Starred varchar
im use list page->page_load
function Page_Load() {
$this->CustomActions[“star”] = “Add Star”; // Where “star” is the id and “Add Star” is the caption of the custom action
}
row_customaction
function Row_CustomAction($action, $row) {
if ($action == “star”) { // Check action name
$rsnew = [“Starred” => “Y”,“nama” => “Y”]; // 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 update record, ID = " . $row[“ID”]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage(“All selected records updated.”);
}
return TRUE; // Success
}
}
eror.
Parse error: syntax error, unexpected ‘’ (T_ENCAPSED_AND_WHITESPACE), expecting ‘-’ or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\xampp\htdocs\t\classes\satuan_list.php on line 1913
any help?
thx
This code:
$result = $this>update($rsnew, “ID = $row[‘ID’]”); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
should be:
$result = $this->update($rsnew, “ID = $row[‘ID’]”); // Update the current record only (the second argument is WHERE clause for UPDATE statement)
solved with code>
page_load:
function Page_Load() {
$this->CustomActions[“check”]= new ListAction(“check”, “APPROVE”, IsLoggedIn(),
ACTION_AJAX, ACTION_MULTIPLE, “Apakah Benar akan Approve?”,
“fa fa-check ew-icon”);
}
row_customaction.
function Row_CustomAction($action, $row) {
if ($action == “check”) { // Check action name
$rsnew = [“Starred” => “Y”]; // 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 update record, id = " . $row[“id”]);
return FALSE; // Abort and rollback
} elseif ($this->SelectedIndex == $this->SelectedCount) { // Last row
$this->setSuccessMessage(“All selected records updated.”);
}
return TRUE; // Success
}
}
but
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
oh yeah how about hiding the check list with the condition check field status …
if ($ status == ‘ok’) active checklist else if ($ status == ‘notok’) checklist is disabled. thanks