⚠ 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

Adding Custom Actions Issue



vaibhav
  • profile picture
  • Member

Posted 02 January 2012 - 14:32 PM

Lately I had been posting comments regarding Adding a custom action control, i am very much interested to work on this library.
Yeah, I know i had been posting the same issue again and again, but i am not clear yet..

I have done following steps to add a custom library

1)
$this->grocery_crud->add_action('Approve', 'http://localhost/project3/images/approve.jpeg', 'admin/approve_deal');

2)In.
grocery-crud / assets / grocery_crud / themes / flexigrid / js / flexigrid.js

I have had added following code in flexigrid.js


$('.crud-action').live('click', function(){
var approve_url = $(this).attr('href');
if( confirm( message_alert_delete ) )
{
$.ajax({
url: approve_url,
dataType: 'json',
success: function(data)
{
if(data.success)
{
$('#ajax_refresh_and_loading').trigger('click');
$('#report-success').html( data.success_message ).slideUp('fast').slideDown('slow');
$('#report-error').html('').slideUp('fast');
}
else
{
$('#report-error').html( data.error_message ).slideUp('fast').slideDown('slow');
$('#report-success').html('').slideUp('fast');

}
}
});
}

return false;
});



Here's the problem.

The function admin/approve_deal is called after that,

THE CONTENT IS NOT REFRESHED.
Like , the messages "Your deal has been deleted" and all the UI are not seen.

I just to implement a custom action , just like Delete Action , and all the UI after that action is executed

Can you tell me where i am going wrong ?
If you need more information on this query , please PM me, i will be very happy to reply.

Thank You.

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 03 January 2012 - 21:31 PM

I got the answer here: http://www.grocerycr...indpost__p__213 and I think the problem is with your json code. Can you send the json code that you have as a respond?