Hello is it possible to add another delete button to Yii CGridView?
I would like it to make an ajax post request to one of mine controllers.
An use case would be:
Lets say I have a blog entry with comments. In administration I would like to have a gridview where I can delete this blog entry (this is already) possible. I would also like to have another delete button next to the original delete button which would only delete blog's comments (which I don't know how to add).
I looked over the HTML generated by Yii framework to see how the original delete button works. One possible solution would be to copy/paste that delete and refresh java script code and modify it a bit. But I don't like this. I have some concerns that if I do this, when I upgrade Yii framework there is no guarantee that my solution will still work.
Use above tutorial and add class="delete" to the new button
'options'=>array('class'=>'delete')
Yii framework assigns ajax call to this class.
array('class'=>'CButtonColumn','template'=>'{remove}{view}{update}{delete}',
'htmlOptions'=>array('style'=>'width:65px'),
'buttons'=>array(
'remove'=>array('url'=>'Yii::app()->createUrl("resolution/removeApp", array("id_application"=>$data->id_application,"id_resolution"=>'.$model->id_resolution.'))','label'=>'Remove application from resolution.','imageUrl'=>Yii::app()->request->baseUrl.'/images/remove.png','options'=>array('class'=>'delete')),
))
You can follow this Using CButtonColumn to customize buttons in CGridView to add a new button which will be calling the action in your controller to delete comments. Cheers.
Related
I have a list of custom posts, and I want to have a sidebar, wherein the information associated with a post selected from the list to load.
If you insist on using ajax to do this then you will need an API for your WordPress site to call back into. Take a look at http://wp-api.org/. It won't necessarily be easy, but you should be able to get it setup and running and then put a piece of JavaScript in a widget to make the call and display the data.
Be careful, that plugin is under active development.
IMO, it would be easier to do this without ajax. Off the top of my head I would say that you could define a shorttag in your functions.php file and then put it in your widget. If the widget appears on a page with a post, pick up the post id, fetch the meta data, and display it.
Cheers!
=C=
Maybe my request is simple, maybe not. I'm fairly new to ruby and everything and face the problem that I need to add a history item from a plugin. I refer to the ticket system Redmine.
Is there a simple way to trigger an event which adds a predefined comment (like "News sent on [date]")? Preferrably the event should be triggered by pressing a button or clicking a link in the redmine web frontend. Like an additional button/link next to the default ones "edit, watch,...).
Can anyone help me here?
The easiest way would be to add a link, with a href to call a javascript function:
Add news entry
The function should add the text you want in the "issue_notes" text field, and send a submit to the "issue-form" form:
function addNewsEntry() {
$('#issue-notes').value = "News sent on [date]";
$('#issue-form').submit();
}
A good example of this is the status_button redmine plugin, this might be a good reference for you as:
it does add some links to the issue page (you also want to add a link to add a new note)
it does change the status on the issue form and submit it (you also want to change a form field and submit it)
I'm working with zend framework ,and i have to remove a drop down list ,after clicking on a button.I recuperate the drop down list from the FORM : $task.
PS :I added a link which can add a drop down list with ajax ,but i can't do the same the work with the remove.
thanks.
Zend Framework is a server-side language, which means it's not suitable for making modifications to the document in the browser. Instead, use javascript or javascript plus a javascript framework. I suggest you look into jQuery.
If you go down the jQuery route, try using something like this:
$('#the-id-of-your-list').remove ()
I have a CI view which uses jquery tab to show some content. One of the tabs loads another controller which uses grocery crud. So the initial display is embeded inside this view. However if I try to edit or update it opens it in a completely seperate page and from then all actions on the grocery crud is in a separate page. How can I embed grocery crud inside a CI view?
This is not yet supported in grocery CRUD but it will be supported as for the new big release of version 1.4 that it is not yet released. If you like to implement the alpha version at your project, you can simply download the latest zip file from github https://github.com/scoumbourdis/grocery-crud (https://github.com/scoumbourdis/grocery-crud/archive/master.zip) and simply go to: application/config/grocery_crud.php and change the line:
$config['grocery_crud_dialog_forms'] = false;
to:
$config['grocery_crud_dialog_forms'] = true;
That's it actually :) . You can see some scrennshort to make sure that this is what you need.
I suggest though for you to wait, at least for the BETA version to release, as it is not 100% done yet.
you should allow sending csrf with the ajax call to allow loading the file with ajax
when we use
$config['csrf_protection'] = TRUE;
what is the place that can i edit to send CSRF of codeigniter with the ajax call ?
I am fairly new to .NET and MVC3 - and even Ajax and Json, and am working on an MVC3 (razor) application, using jqGrid, and so far it is immense(jqgrid that is!) and has dealt with everything I have thrown at it.
However, I have One Outstanding peice of functionality that I do not know How to accomplish.
Within the Edit form of a Row, I have Placed a Custom button called 'Reset Password'. I need the Onclick Event to call a piece of functionality in my Controller to go through some logic, generate a Password, and Return the new Password to the Screen.
Can anyone tell me How can I achieve this?
May thanks in Advance.
You can return a partial view result or json data from the action.
See the partial view approach here