can't select module info on list_items

edited June 2015 in Modules
I've written several modules now but have one that lists all the items I have created, but they are not selectable so I can edit/view/delete them. I've compared against the other modules I have written and I can't see what I have missed.

I can edit them if I know the id and go to the proper URL appropriately (e.g.: navtech/projects/edit/1).

Any ideas or suggestions?

Comments

  • edited 1:02PM
    There is a "rows_selectable" parameter that can be set on a module. By default it is TRUE (if not provided). Did you by chance add it and set it it to FALSE? Or by chance, did you specify the 'table_actions' parameter for the module to be empty in the fuel/application/config/MY_fuel_modules.php
  • edited 1:02PM
    I added to module.php in the items() function, just before "if ( ! $this->rows_selectable)":

    echo PHP_EOL . "this->rows_selectable:" . PHP_EOL . $this->rows_selectable;

    The result is:
    this->rows_selectable: 1

    I added just before "foreach($this->table_actions as $key => $val)":

    echo PHP_EOL . "this->table_actions:" . PHP_EOL . print_r($this->table_actions);

    The result is:
    Array ( [0] => EDIT [1] => VIEW [2] => DELETE ) this->table_actions: 1

    It all looks good to me. I'm a bit perplexed on this one. :(
  • edited 1:02PM
    Are you logged in as the super admin user or a user with specific privileges?

    If you are already looking at the module.php file to try and debug, the logic for rendering that starts around line 330 in the items method. On line 462 is where it actually renders the string for the table.
  • edited 1:02PM
    Yes, I'm super_admin
  • edited 1:02PM
    FYI, I created another simple module, added it to the nav menu and pointed the table to my projects table and now I get what I expected. I'll start migrating the code over and see if it's something I've done, which seems like the obvious case. I'll let you know what I find.
  • edited 1:02PM
    Found it.

    In the $config['modules']['navtech_projects'] I am missing the 'id' column:

    'table_headers' => array(
    'name',
    'last_remote_update',
    'published',
    ),

    Argh!

    'table_headers' => array(
    'id',
    'name',
    'last_remote_update',
    'published',
    ),

    Now works.
  • edited 1:02PM
    Ah yes... that is required for it to work.
  • edited 1:02PM
    It's always the simple things. :)
Sign In or Register to comment.