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 ?
Related
Currently I am working on a wordpress site. What I want to do is:
Changing the used contact form (over shortcodes, done by a plugin), everytime the user changes his selection of options provided by a dropdownlist with one form as the default one.
I want to achieve this by using ajax. I could send the Index of the selected option to a php file, but I dont know how exactly I would execute the shortcode in php and return the result to the wp site.
Any information and advice would be great!
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.
I am working on classified ads project in asp.net mvc3. I am facing problem in filter search page I want to change the URL without loading the whole page like Facebook or Linkedin before change:
http://localhost:4847/Category/Clothing/
after change when user remove category:
http://localhost:4847/Category/
And when user select category it should be change to append category as I show on top.
I am using ajax for filter search
You can make use of the Html5 History API
Anyway this is an Html5 feature and not all browsers may support it. In this case I would suggest directly using a plugin that degrades to hash changes if not supported, like History.js
This is fundamentally the same question as how to fix the browser history back-forward buttons. Checkout What is the best back button jQuery plugin?, it really could help you alot!
I am starting to learn MVC 3 (Razor engine) and I am having difficulty understanding why my changes don't get applied to page. Basically I have done this: I have imported my DAL and model projects, I have created one controller and one view (in their respective folders) and in the controller Index method I am passing list of products to View
Data.ProductRepository repository = new Data.ProductRepository();
var list = repository.GetProducts(1, true);
return View(list);
And the data is displayed correctly on the page. Now, I want to reformat the columns that are auto generated in the view (I used scaffold list tamplate). The problem is that no matter what I change into this view, the changes are not reflected on the page. I stop the web server, start again, always the same layout is displayed. Even removing columns from table doesn't work. It seems like it is using some cashed version of this page.
Thanks,
Goran
After reinstalling both OS (XP) and IDE, it started working without any proeblems.
In the past I have developed large extjs single page applications. Many users get frustrated for not being able to use the Back or Fwd buttons or reload the page.I would also like to warn the user if they navigate away from a page without completing a work flow, and enable users to directly access particular views.
For the next application, I am thinking of using the Codeigniter php MVC framework. It is possible to something similar to this example. I am stucked thinking about the navigation. If I load the ExtJs for each view, that is a significant slowdown.
How best to approach this?
Have a look at the Ext.History class (Ext.util.History on Ext4). With it you can register listeners for changes to the hash:
Ext.History.on('change', function( token ) {
console.log('token changed to: ', token);
});
The Ext.History singleton includes forward() and back() methods for triggering navigation from within the client-side code.
By having only the hash part of the URL change the browser stays on the same page, thus eliminating the need to reload the Ext library.
How this would integrate with your PHP framework I cannot say. I am not familiar with CodeIgniter and your example link goes to a dead page.
Also, do note a caveat with History in that under Ext3 at least it may give you issues with newer browsers. If this is the case an alternative is to code your own History-like solution using the 'hashchange' browser event as illustrated in this answer.