⚠ 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

Customized Multiple Selection Actions like DELETE



kamel
  • profile picture
  • Member

Posted 21 December 2017 - 16:57 PM

By default, Grocery Crud allows only DELETE ACTION when we enable Multiple Selection (Check box by left).
I need to include more customized Multiple Selection Actions. I will develop the callback function of each selection action. But I only need to know how to create the code to add more Multiple Selection Actions like as DELETE actions of Grocery Crud.

Is there any suggestions about this or anyone did it before ?


kamel
  • profile picture
  • Member

Posted 27 December 2017 - 13:28 PM

Any help here please !!!


Amit Shah
  • profile picture
  • Member

Posted 27 December 2017 - 14:22 PM

Well my friend, you need to customize your view to set the additional actions out there in the GC theme's view page. As i understand you are using bootstrap theme. You need to make a copy of a the same theme - rename it and make the alterations as required. Post that - you need to set the theme (new theme name) in the function and use it.

 

I remember doing such customization way back in some project .. let me see if i possibly get my hands on the same. But wont recommend you wait for my revertals.. as i don't even remember where and which project.


kamel
  • profile picture
  • Member

Posted 27 December 2017 - 18:21 PM

Thank you Mr. Amit very much my friend,

I will try to starting in this but if you could to send me yours as example to check it out please, 

 

Best Regards and Many Thanks


Amit Shah
  • profile picture
  • Member

Posted 28 December 2017 - 04:43 AM

You need to tweak up a bit of code in the theme - if you notice, you hardly have much option / space to put up another action in the theme besides delete. First, you need to build up some space up there ...Or may be bring Delete and all other actions in a dropdown. (Dropdown seems 2 be a better option).

 

Once done, you need to create custom JS to pickup / trigger action on change of the element in the dropdown. Give a popup confirming the action and then just perform the same.

 

What in the code needs to go - get the selection of all the checkboxes that have been checked .. along with the same, grab the set of ID's - make the relevant post with the selected IDs to take action 

 

Controller - u know and will do it better with ..

 

Rest - you just need to add the JS to the crud by using set_js

 

1 thing to keep in mind - you need to write the functions that will hook on the change event in window.load function rather then $.ready .. because by the time this js is loaded - jquery is yet to be loaded. 

 

Hope you can build up the code around this logic...

 

Happy GCing :)


kamel
  • profile picture
  • Member

Posted 01 January 2018 - 08:45 AM

Thank you Amit,

I already started in this,

But what I thinking is to make this in dynamic way like set_action() make new grocery crud function set_multiaction()

For using this in another project cuz I thing multi action is important in any grid.

 

Happy New Year


Lambou
  • profile picture
  • Member

Posted 14 December 2020 - 09:45 AM

Hi, i am facing with this problem,

i wanted to add button like deleMultiple  to do some action to many row 

Please is there an update ? in grocery enterprise ?

Please quive me the process to do that.

 

Thank in  advance.