Row Custom Action

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
gopalverma1
User
Posts: 10

Row Custom Action

Post by gopalverma1 »

Sir,

The row custom action is giving error "star not found", when i click the "Add Star" link in the List Page.
Code as in documentation just copied and pasted for checking

function ListOptions_Load()
{
    // Example:
    $opt = &$this->ListOptions->add("new");
    $opt->Header = "xxx";
    $opt->OnLeft = true; // Link on left
    $opt->moveTo(0); // Move to first column    
}
// ListOptions Rendered event
function ListOptions_Rendered()
{
    // Example:
    //$this->ListOptions["new"]->Body = "xxx";
 $this->ListOptions["new"]->Body = "<a href=\"#\" onclick=\"return ew.submitAction(event, {action: 'star', method: 'ajax', msg: 'Add star?', key: " . $this->keyToJson(true) . "});\">Add Star</a>";    
}

// Row Custom Action event
function Row_CustomAction($action, $row)
{
    // Return false to abort
    if ($action == "star") { // Check action name
            $this->setSuccessMessage("All selected records updated.");
        return true; // Success
    }
}

When i was searching for solution in the forum, i found one topic @ /viewtopic.php?t=51081
to check the protected function processListAction()

i did var_dump as

$actionCaption = $userAction;
var_dump($userAction,$filter);
$listAction = $this->ListActions[$userAction] ?? null;

it is showing string(4) "star" string(17) "(ProductID = 3)" 'star' not found

Then i var_dump as

            $actionCaption = $userAction;
            $listAction = $this->ListActions[$userAction] ?? null;
            if ($listAction) {
                var_dump($userAction,$filter);
                $this->UserAction = $userAction;

giving error "star not found", execution is not entering if ($listAction) {

i could not figure out where i did mistake.
Anything i am missing or entered incorrect sir


mobhar
User
Posts: 11732

Post by mobhar »

You should define the star action first in Page_Load server event that belongs to the List Page. See the code in Example 3 from this documentation.


gopalverma1
User
Posts: 10

Post by gopalverma1 »

Thank you sir,

My mistake for not reading the documentation properly.


Post Reply