⚠ 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 forum is read-only and soon will be archived. ⚠

Don't want to show table (in the view)

field table columns render

  • Please log in to reply
2 replies to this topic

#1 Abdul Wahid

Abdul Wahid


  • Members
  • Pip
  • 2 posts

Posted 23 March 2014 - 03:36 PM

Hi everyone,


I am having a problem. I want to to add data to my database through awsome grocery crud but I don't want to show the table which is shown by default by grocery crud. below are some images if you want to pictures what I mean.


this is what my page looks like when it first loads

Screen Shot 2014-03-23 at 8.33.08 PM.png



But this is how I want it to look when it first loads and when the form is field  I want to redirect the users to different page.

Screen Shot 2014-03-23 at 8.34.11 PM.png


Thanks in advance.

#2 victor


    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts

Posted 23 March 2014 - 10:37 PM

My first thought is "Don't use GC where it is not necessary". It is a wrong way to use a big hammer where you can use a small hammer. You have only a few fields, try to develop that withot GC.

#3 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts

Posted 24 March 2014 - 04:22 AM

Hi Abdul Wahid


Correct me if i am wrong, what i understand is that if you taking user to an action where it is having a GC list and if there are no records in the same, you want to redirect the user to the add page instead of showing him the list page. If that is the case, here is the solution

if($crud->getstate() == 'list') {
	$count = //run a count query OR model method on the table to get the total rows in the table
	if($count <= 0) {
		redirect('controller/action/add) --- just add the add method in the last to the same url

Think that should do it...

Also tagged with one or more of these keywords: field, table, columns, render

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users