Discuss MySQL Ajax Table Editor
by jangi » Fri Mar 26, 2021 8:37 pm
The add_fun callback does not seem to function at all. edit_fun works, but not add_fun. Am I missing something?
- Code: Select all
public function genPassword($col,$val,$row)
{
return 'pass';
}
...
$tableColumns['password'] = array(
'display_text' => 'Password',
'on_edit_fun' => array(&$this,'encodePassword'),
'add_fun' => array(&$this,'genPassword'),
'edit_fun' => array(&$this,'removePassword'),
'perms' => 'ECAXQSHOF'
);
-
jangi
-
- Posts: 2
- Joined: Fri Mar 26, 2021 8:34 pm
by jangi » Mon Mar 29, 2021 4:32 am
Figured it out. The logic in the getInputDefaultValue() function precludes using 'add_fun' as the initial value for new rows is blank (strlen==0). By adding another else if block this will now work:
- Code: Select all
...
else if(isset($info[$addOrEdit.'_fun']) && is_callable($info[$addOrEdit.'_fun']) && $addOrEdit == 'add')
{
$defVal = call_user_func($info[$addOrEdit.'_fun'],$col,$defVal,$row,$this->instanceName);
}
-
jangi
-
- Posts: 2
- Joined: Fri Mar 26, 2021 8:34 pm
Return to Open Discussion
Who is online
Users browsing this forum: No registered users and 10 guests