Advanced module model - list view default click action for table-less model...

edited November 2012 in Feature Requests
Hello there!

I'm writing a supersimple REST client library to connect to Goodsie (via Httpful) and pull the products catalogue as JSON.
I'd like to display the list of products 'as if' it were a normal model - and I'm already done with that: It's just as easy as writing a list_items() method that returns an array populated by the data returned via the API call.

Still, I have a few questions:

1) is it possible to have a table-less (ie no database table) model still show up in the Fuel admin area? I'm retrieving the data via JSON calls on the fly, and I dont need to store them in a table. It seems to me that without a table the Base_module_model's construct will simply die on me... Is there a workaround?


2) How can i override the Data_table library method that generates the links for the table rows? What I'm trying to do is that when the admin clicks on a row (a product) he gets sent to an external URL, but I can't seem to have any luck with this... I've set the model's config as 'readonly' => true, however when i click on a row i get sent to the root of the site ... mmh.

Thanks!

Comments

  • edited 9:48AM
    You can have a table-less model. The assets model does this since it stores everything on the file system. There are a few method you'll need to implement, like the list items method,

    With regards to the Data_table library, you can pass the following in your module's config. {placeholder} can be a key value from the array (e.g. title), and it will substitute it for each row. You'll need to grab the most recent from the repo because I had to make a few tweaks to get the attrs to work to work properly.
    'table_actions' => array('EDIT' => array('url' => 'http://www.test.com/{placeholder]', 'attrs' => 'target="_blank"')),
  • edited 9:48AM
    Thanks! worked like a charm!
Sign In or Register to comment.