PROBLEM WHEN COPY ROW

Discuss mysql ajax table editor.

PROBLEM WHEN COPY ROW

Postby hiaslplz on Mon Mar 15, 2010 1:18 pm

PROBLEM WHEN COPY COLUMN WHICH HAVE PRIMARY KEY, UNIQUE OPTION,
I NEED TO COPY ROW WHICH INCLUDE COLUMN WITH (PRIMARY KEY AND UNIQUE OPTIONS ) BUT NOT AUTO INCREMENT BECAUSE THE TYPE IS VARCHAR WHICH CONTAIN CHAR AND NUMBERS AND REMOVED "C" FROM THE PERMISSION OF THIS COLUMN BUT STILL CAN'T COPY ROW
hiaslplz
 
Posts: 29
Joined: Tue Mar 09, 2010 3:01 pm

Re: PROBLEM WHEN COPY ROW

Postby admin on Mon Mar 15, 2010 2:33 pm

You will have to add an on copy callback function to the primary column and give it copy permissions. Then in the callback function return a unique value for the primary column.
admin
Site Admin
 
Posts: 651
Joined: Fri Jul 11, 2008 1:34 am

Re: PROBLEM WHEN COPY ROW

Postby hiaslplz on Wed Mar 17, 2010 4:22 am

Dear Admin

thanks for your replay ,

I wrote this code but display error

" Parse error: parse error, expecting `T_FUNCTION' "



This is the code please tell me what is problem

Code: Select all

$tableColumns['Code'] = array('display_text' => 'Code', 'perms' => 'CVTAXQSHOM','call_back_fun'=> array(&$this,'on_copy_row'));



This is function

Code: Select all
function on_copy_row($col,$val,$info)
{
return $info['Code']=218;
}
hiaslplz
 
Posts: 29
Joined: Tue Mar 09, 2010 3:01 pm

Re: PROBLEM WHEN COPY ROW

Postby admin on Wed Mar 17, 2010 2:11 pm

Well one error I see is that you need to use on_copy_fun instead of call_back_fun
Code: Select all
$tableColumns['Code'] = array('display_text' => 'Code', 'perms' => 'CVTAXQSHOM','on_copy_fun'=> array(&$this,'on_copy_row'));

As for your parse error, that could be anywhere in your code. I would have to see more information ie the line # where it happened and the code at that line #.
admin
Site Admin
 
Posts: 651
Joined: Fri Jul 11, 2008 1:34 am

Re: PROBLEM WHEN COPY ROW

Postby hiaslplz on Wed Mar 17, 2010 2:45 pm

Thanks Admin


Its Work

I want make the following

when user click copy i need before paste on database show edit window which display the copy of target row with the data so user can change the primary column because its contain numbers & string and not only number before commit on database.


thanks
hiaslplz
 
Posts: 29
Joined: Tue Mar 09, 2010 3:01 pm

Re: PROBLEM WHEN COPY ROW

Postby hiaslplz on Thu Mar 18, 2010 3:54 pm

thanks Admin i made it and this is my code

Code: Select all

$tableColumns['Code'] = array('display_text' => 'Code', 'perms' => 'CEVTAXQSHO','on_copy_fun'=> array(&$this,'on_copy_row'));



Code: Select all
function showEditScreen($id,$row)
{
   $this->Editor->retArr[] = array('where' => 'javascript', 'value' => 'toAjaxTableEditor("edit_row","'.$id.'");');
}

function on_copy_row($col,$val,$info)
{
$id=$info['Code'];
$this->Editor->setConfig('afterCopyFun',array(&$this,'showEditScreen'));

}


hiaslplz
 
Posts: 29
Joined: Tue Mar 09, 2010 3:01 pm


Return to Open Discussion

Who is online

Users browsing this forum: Google Adsense [Bot] and 3 guests