I want to add delete & update for each tablerow

A place for users and developers of the Xataface to discuss and receive support.

I want to add delete & update for each tablerow

Postby chichi » Fri Jul 09, 2010 12:56 pm

Hello,
My database-table gets listed now with all records correctly.
Is there a way to add an update-Button and Delete-Button at the end of each row.
With this I can make changes in the database faster.

I found this post from 2008:
Currently there is no action in dataface to do delete based on the selected items in list view.
However, you can link directly to the "delete" form for a record using the Dataface URL conventions.
e.g. index.php?-action=delete&product_id=10
would allow you to delete the product with product_id = 10.
-Steve


I have seen the datagrid-Module to edit inLine, this is a nice feature,.
I welcome the Update-Button at the end of each row to jump directly in edit-Mode. I hope you understand and can help me with this. :D

chichi
chichi
 
Posts: 28
Joined: Fri Jul 09, 2010 3:05 am

Re: I want to add delete & update for each tablerow

Postby shannah » Tue Jul 13, 2010 10:21 am

Yes. Add an action with the category "list_row_actions". Here is an example action from one of my apps' actions.ini file

Code: Select all
[translate_job_row]
   label="Translate"
   url="{$site_href}?-action=webpage_translation_form&-table=webpages&-job_id={$record->val('job_id')}"
   url_condition="$record"
   condition="$record and $query['-table'] == 'proof_jobs' and $record->val('completed')==0"
   permission=translate job
   category=list_row_actions


This added a translate button next to each row in list view with the specified URL. A few things to note:

1. Since I'm calling $record->val() in the URL, I need to set the url_condition parameter to only evaluate the URL if the $record is not null.
2. $record represents the current record/row.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: I want to add delete & update for each tablerow

Postby shannah » Tue Jul 13, 2010 10:23 am

Another note, you can get the URL for a particular action of a record using the Dataface_Record getURL() method.

e.g.

Code: Select all
$record->getURL('-action=edit')
$record->getURL('-action=view')
$record->getURL('-action=delete&-delete-one=1')
etc..
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: I want to add delete & update for each tablerow

Postby chichi » Wed Jul 14, 2010 12:42 pm

thanks for the infos, i will test this.

chichi
chichi
 
Posts: 28
Joined: Fri Jul 09, 2010 3:05 am

Re: I want to add delete & update for each tablerow

Postby amrcode1 » Thu Sep 02, 2010 7:16 am

Hi, Steve, This function is still available? I try to use it in my aplication but got nothing, it seems very interesting. I use xata 1.2.2. My definition in action.ini (in my app dir)

Code: Select all
[test_menu]
label = "Test"
url = "{$site_href}?-action=fss_codes&-table=doc_schema&-type={$record->val('type')}"
url_condition = "$record"
condition = "$record and $query['-table'] == 'doc_schema'"
permission = edit
category = list_row_actions
amrcode1
 
Posts: 18
Joined: Thu Nov 12, 2009 11:09 am

Re: I want to add delete & update for each tablerow

Postby shannah » Thu Sep 02, 2010 9:37 am

Sorry.. There's a bug right now that ties this feature in with the ajax_record_details feature. You need to enable ajax record details by adding the following to your conf.ini file:
Code: Select all
[_prefs]
   disable_ajax_record_details=0
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: I want to add delete & update for each tablerow

Postby amrcode1 » Thu Sep 02, 2010 10:33 am

Thank's, is working now
amrcode1
 
Posts: 18
Joined: Thu Nov 12, 2009 11:09 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 19 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved