⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

dynamicall created tables



ccollins
  • profile picture
  • Member

Posted 19 April 2012 - 15:38 PM

I have some tables that I display that are not based on a db table per se. For instance one table counts all the commands in a command queue pertaining to a particular device and then displays the count and the device information along with some other statistics calculated in a list. I want to use the same gcrud theme as all my other tables. Can I dynamically columns that don't exist in a table and fill them in?

Also want to list certain fields but not make them editable. How would I do that?

Also I did not see support for radio buttons.

Sorry for these newbie question, just started looking at Grocery Crud for my site. I tried search the forum but I could not find relevant

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 20 April 2012 - 04:59 AM

Hello [member='ccollins'] and welcome to the forum

Ok if let's say each paragraph is a request I have your answers below:

1. You can add as many fake columns and add/edit fields as you want by simply add more columns/fields. For example:


$crud->columns('name','test1','test2'); // test1 and test2 doesn't exist anywhere


and use callbacks to add some rows for them. If this is your request then it's easy. If you just want to the columns to have some more complicated queries, grocery CRUD doesn't handle very well the custom queries without changing the core code for now so the only way to do it is with the set_model method (before using it I suggest to be more familiar with grocery CRUD first as it is more complicated to use it)

2. Just add the add_fields and edit_fields :


$crud->add_fields('firstname','lastname','age');
$crud->edit_fields('firstname','lastname');


for example here you will not edit the age field

3. No, still it doesn't support radio buttons. The only radio button that supports is the active/inactive thing when you have a tinyint or int with length 1 in your database.