_residential is a view having CHtml form. It has ajaxSubmitButton which updates div #ajaxUpdate on index.php
After showing results in CListView, it shows pages. Now on clicking on any of the page buttons, #ajaxUpdate is going blank. Does anyone have any idea about it?
How to debug this kind of problems… Please help.
Edit: @abajja : Thanks for notifying. I have changed the code. to CController::createUrl
I wanted to use zii… but it is very difficult to use. I finally figured out how to use CJuiTabs with contents loaded statically! Cause, making ajax’ request for each tab was slow for me. so I called renderPartial for all 3 views sending models to each n getting a content instead of direct echo (3rd option in renderPartial).
then sending all these 3 contents on one render() method where i can use…
<?php 'content'=>$tab1Content; ?>
Now I have one more problem.
Situation is like following.
3 tabs. I have forms in each. clicking on a button in tab1, i update a div outside tabs which is #ajaxUpdate.
this div have a button on which I want to open a jquery-ui dialog. How to use CJuiDialog to achieve this?
Please any example? or hint?
Also, there is very big concern…[b]
I have CListView inside that div, loaded dinamically after clicking on tab form. so when pages are loaded, on clicking _page/2(page navigation) it sends the number of requests equals to the number of times i have clicked the button in tab form. [/b]
Which means , as I keep on searching, without page refresh, site may become slow on clicking on page navigation.!!!
Some (laboratory) code to work with tabs. Please note that I use the jquery.tools.min.js library.
controllers/InfoController.php
public function actionRohit() {
$this->render('rohit');
}
public function action_residential() {
//your search for data e.g
// $data = $info->findAllBySql($sql);
$this->layout = 'r-3';
$this->render('test', array('data'=>$data,'pages'=>$pages));
}
A lot of the Zii libraries uses ajax which I find to be very annoying. Havn’t talked with the other devs about this yet… but I see no point in making pagination use ajax, or tabs for that matter. And it’s not super easy to fall back to non-ajax either… You do in fact have to deal with live() jquery methods, or rebind the events if you want to use js within an ajax return
Personally I liked the way pagination works… but I found that, while u send request for pagination, it again gets whole bunch of text like menu bar items, footer etc. If we are using pagination we should only get the data and jquery loaded on client side should do the work of fixing the values inside the box. Or may be some json response for these kind of things will be neat and light on bandwidth.
@jonah I think , not all js files like jquery or jquery-ui are registered by default. It depends on which components you are using and what is its dependency…
@abajja Thanks for the example It will surely help.
the search functionality. You will get the idea, what is happening. On click of send inquiry button, dialog opens up. Now on next search, it will not work as there are two divs added internally with same contents!
Also, when you search multiple times say 3 times, and then click on page navigation it sends 3 times request! The way I have put my code along with different views, causing this problems! But I don’t know how to solve it!
@rohit: You actually only need to send back the grid view result in ajax response. The code generated by crud tool is for simplicity, which saves you from writing a separate view file. There’s also a bug in 1.1.0 regarding the number of ajax requests, which has been fixed in svn already.
But I tried svn for my code, and still it sends multiple requests.
What might have gone wrong?
Is it because i create CListView dynamically using ajax every time I search?
Similar problem is there with dialog. It is adding div multiple times at the of body tag outside #page.
I don’t know how to stop that!
If I use CJuiDialog widget on same page with CListView it works, but on next search, it adds duplicate div at the end of <body> tag. So, stops working.
If I use widget on upper level at index page only, instead of _ajaxSearchResults page, it says, ("#inquiryForm").dialog dialog is not a function! What could be the reason?