data_table : add_action and default_column_action

edited July 2011 in Feature Requests
I'm adding an action inside an advanced module's model, to have this new action appear in the view provided by the data table, like so:

$this->data_table->add_action('MEDIA', 'links/media/{id}');
but then this action becomes the default one when clicking on the listed rows.
So i thought i should set the default action like this

$this->data_table->default_field_action = array('EDIT' => 'links/edit/{id}');
but it won't help. Am I missing something? What is the correct way to do so?

Comments

  • edited 3:16PM
    The default_field_action is the default actions to display for each row and not necessarily what the row clicks to. That is actually handled with javascript in the BaseFuelController.js file. It triggers the link on the first action displayed (e.g. that is why EDIT is always listed before VIEW and DELETE).
  • edited 3:16PM
    And how can i edit the order of the actions then?
  • edited 3:16PM
    If you are using a module config file (e.g. like fuel/modules/fuel/fuel_modules.php OR fuel/modules/blog/blog_fuel_modules.php ), you can add/modify the "table_actions" value of your module configuration:
    'table_actions' => array('MEDIA' => 'links/media/{id}', 'EDIT', 'VIEW', 'DELETE'),
    The value of the key "MEDIA" can be a string as in the example, or a lamda function.

    If you are using the add_action method like you have above, it should be the order in which you add the actions.
  • edited 3:16PM
    Thank you!
Sign In or Register to comment.