Jump to content


Add print action in list view for each line

print add_action Grocery CRUD

  • Please log in to reply
3 replies to this topic

#1 kat

kat

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 17 January 2018 - 09:43 AM

I am a beginner in CI and grocery crud I want to add action print like this https://www.groceryc...ions/add_action for each line next to the button edit and delete and view to print only the form displayed

I am a beginner in CI and grocery crud I want to add action print for each line next to the button edit and delete and view to print only the form displayed



#2 darkstalker

darkstalker

    Member

  • Members
  • PipPip
  • 24 posts
  • LocationItaly

Posted 17 January 2018 - 06:46 PM

you need :

 

1) $crud->add_action('Print form', '', '','ui-icon-image',array($this,'print_a_form'));

 

2) a function "print_a_form" like

 

function print_a_form($primary_key , $row)
{
}

 

where you can call a method (that you need to write) to get the form data based on $primary_key for example,

and then call a view (that you need to write) to show the data as you like and show also a print button that print what you see in the view.

 

so:

 

1) add_action

 

2) function to call from add_action

 

3) method to get the data

 

4) view to show the data and print button

 

-----------------

instead of point 4, remember that you can see the data already inside grocery crud, so you can directly insert the print command inside the function at point 2, after you got the data you want

 

Hope this can help you go in the right direction. Then you need to practice.



#3 darkstalker

darkstalker

    Member

  • Members
  • PipPip
  • 24 posts
  • LocationItaly

Posted 17 January 2018 - 06:49 PM

another tip:

 

"the data you want" ( the data of the row you want to print) are already inserted in the $row variable inside the function you call with the add_action.

If you only need that data displayed in the grocery crud row, you don't need the method at point 3 too. You just need to print inside that function at point 2



#4 kat

kat

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 19 January 2018 - 11:52 AM

thanks darkstalker for your reply but I want to have a button next to 'back to list' so that I could print this form

and I can't edit in the kernel libraries of grocery crud

Attached Thumbnails

  • Capture.PNG






Also tagged with one or more of these keywords: print add_action, Grocery CRUD

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users