⚠ 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

Disable edit and delete actions for specific rows



midnigther

midnigther
  • profile picture
  • Member

Posted 16 July 2012 - 18:16 PM

I want to disable the edit and delete actions for specific row based in a row string.
I made a simple jquery script to prevent it however after an ajax request the buttons remains.


jQuery(document).ready(function($) {
$("table td:contains('Admin')").closest("tr").find("a .edit-icon").remove();
$("table td:contains('Admin')").closest("tr").find("a .delete-icon").remove();
});


How to catch an ajax request to prevent this?

fdias

fdias
  • profile picture
  • Member

Posted 16 July 2012 - 23:33 PM

If you are using flexigrid theme, find the ajax_refresh_and_loading functions on the file below and play with it. Try calling your function there.

assets\grocery_crud hemes\flexigrid\js\flexigrid.js

Cheers

midnigther

midnigther
  • profile picture
  • Member

Posted 17 July 2012 - 00:47 AM

[quote name='fdias' timestamp='1342481619' post='2736']
If you are using flexigrid theme, find the ajax_refresh_and_loading functions on the file below and play with it. Try calling your function there.

assets\grocery_crud hemes\flexigrid\js\flexigrid.js

Cheers
[/quote]

The datatables theme has this method too?

fdias

fdias
  • profile picture
  • Member

Posted 17 July 2012 - 12:00 PM

I believe so on the file

assets\grocery_crud hemes\datatable\js\datatable.js

rikoy

rikoy
  • profile picture
  • Member

Posted 01 August 2012 - 04:09 AM

maybe you can try $crud->unset_delete(); and $crud->unset_edit(); in function

cmiiw

fdias

fdias
  • profile picture
  • Member

Posted 13 August 2012 - 17:36 PM

@rikoy these functions would disable the delete and edit functions for all rows. midnighter wants to disable for specific rows only.

Cheers

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 19 September 2012 - 15:35 PM

@midnigther and this solution work for you?, can you talkme more info?

midnigther

midnigther
  • profile picture
  • Member

Posted 20 September 2012 - 01:00 AM

[member=carlinchisart] The solution works well if the code is inside the list_template.php otherwise after the grid update the changes back to the normal way. Well, I hate do changes in the grocery crud files to improve that I made this code:

public function _callback_delete_user ($primary_key = null)
{
$user = $this->users_m->get_user_from_id ($primary_key);
if ($user)
return (!$user->is_native) ? $this->users_m->delete_user ($primary_key) : FALSE;
}


The icon is visible for all rows but only delete non native users. Unfortunately I don't have user feed back.

carlinchisart

carlinchisart
  • profile picture
  • Member

Posted 20 September 2012 - 03:35 AM

thanks!!!

Vinsensius Angelo

Vinsensius Angelo
  • profile picture
  • Member

Posted 26 October 2013 - 04:35 AM

I have this problem to, how to hide a specific row action link??