⚠ In case you've missed it we are migrating 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. ⚠


Disable edit and delete actions for specific rows

disable actions edit delete

  • Please log in to reply
9 replies to this topic

#1 midnigther

midnigther

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 16 July 2012 - 06: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?

#2 fdias

fdias

    grocery CRUD Addict

  • Members
  • PipPipPip
  • 93 posts

Posted 16 July 2012 - 11: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

#3 midnigther

midnigther

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 17 July 2012 - 12:47 AM

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


The datatables theme has this method too?

#4 fdias

fdias

    grocery CRUD Addict

  • Members
  • PipPipPip
  • 93 posts

Posted 17 July 2012 - 12:00 PM

I believe so on the file

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

#5 rikoy

rikoy

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 01 August 2012 - 04:09 AM

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

cmiiw

#6 fdias

fdias

    grocery CRUD Addict

  • Members
  • PipPipPip
  • 93 posts

Posted 13 August 2012 - 05:36 PM

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

Cheers

#7 carlinchisart

carlinchisart

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts

Posted 19 September 2012 - 03:35 PM

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

#8 midnigther

midnigther

    Advanced Member

  • Members
  • PipPipPip
  • 44 posts

Posted 20 September 2012 - 01:00 AM

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.

#9 carlinchisart

carlinchisart

    Advanced Member

  • Members
  • PipPipPip
  • 67 posts

Posted 20 September 2012 - 03:35 AM

thanks!!!

#10 Vinsensius Angelo

Vinsensius Angelo

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 26 October 2013 - 04:35 AM

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






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users