Connecting Tech Pros Worldwide Forums | Help | Site Map

jquery pagination problem

pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#1: 3 Weeks Ago
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.         <script src="jquery.js" type="text/javascript"></script>
  4.         <script src="jquery.rating.js" type="text/javascript" language="javascript"></script>
  5.         <link href="jquery.rating.css" type="text/css" rel="stylesheet"/>
  6.         <link rel="stylesheet" type="text/css" href="style.css">
  7.  
  8. <script type="text/javascript">
  9. $(document).ready(function() {
  10.     $("#mobile_brand").change(function() {
  11.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  12.  $("#change").html(data);
  13. });
  14.     });
  15.     $("#property3").change(function() {
  16.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  17.  $("#change").html(data);
  18. });
  19.     });
  20.     $("#property4").change(function() {
  21.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  22.  $("#change").html(data);
  23. });
  24.     });
  25.     $("#property6").change(function() {
  26.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  27.  $("#change").html(data);
  28. });
  29.     });
  30. });
  31. </script>
  32.  
  33. </head>
  34. <body>
i have a small prob. the jquery.rating.js does work when the page is loaded but when the filtering takes place with the further jquery statements the 1st jquery.rating.js which replaces all the checkboxes with the star symbol does not work it displays the checkbox as it it!! i dont know whts the prob.
best answer - posted by acoder
I've had a quick look at the code and I think I see where the problem might be. When you load the page, the code runs, so the page is updated, but when you make an update, you need to re-run the code to convert the radio buttons back to stars. Here's the code which you can try:
Expand|Select|Wrap|Line Numbers
  1. $('input[type=radio].star').rating();

RamananKalirajan's Avatar
Needs Regular Fix
 
Join Date: Mar 2008
Location: Chennai - India
Posts: 350
#2: 3 Weeks Ago

re: jquery pagination problem


Hi,
Just place the file inclusion in the end of the body in your html... Like call the function after the page is loaded... This will do.

Thanks and Regards
Ramanan Kalirajan
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#3: 3 Weeks Ago

re: jquery pagination problem


what files !! i tried to keep the javascript files at end of body!!! but did not work!!!
RamananKalirajan's Avatar
Needs Regular Fix
 
Join Date: Mar 2008
Location: Chennai - India
Posts: 350
#4: 3 Weeks Ago

re: jquery pagination problem


Hi, I dont have much knowledge on JQuery. I have worked in Prototype. Is there any Listener function or observer function for body load, if there just use that and place the script code inside that

Thanks and Regards
Ramanan Kalirajan
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#5: 3 Weeks Ago

re: jquery pagination problem


as u can see in the code
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. $(document).ready(function() {
  3.     $("#mobile_brand").change(function() {
  4.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  5.  $("#change").html(data);
  6. });
  7.     });
  8.     $("#property3").change(function() {
  9.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  10.  $("#change").html(data);
  11. });
  12.     });
  13.     $("#property4").change(function() {
  14.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  15.  $("#change").html(data);
  16. });
  17.     });
  18.     $("#property6").change(function() {
  19.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  20.  $("#change").html(data);
  21. });
  22.     });
  23. });
  24. </script>
  25.  
is the code where ready body load is taken care of .
should i use the script code inside here or how?
RamananKalirajan's Avatar
Needs Regular Fix
 
Join Date: Mar 2008
Location: Chennai - India
Posts: 350
#6: 3 Weeks Ago

re: jquery pagination problem


Can you please post the code for this "jquery.rating.js which replaces all the checkboxes with the star symbol". If possible attach the html files and Js Files.

Thanks and Regards
Ramanan Kalirajan
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#7: 3 Weeks Ago

re: jquery pagination problem


you can find the jquery.rating.js

http://www.fyneworks.com/jquery/star.../#tab-Overview

i just name the checkbox class as star and it replaces it with star . if u still want ma code i will paste it.
RamananKalirajan's Avatar
Needs Regular Fix
 
Join Date: Mar 2008
Location: Chennai - India
Posts: 350
#8: 3 Weeks Ago

re: jquery pagination problem


Post Your Code...

Thanks and Regards
Ramanan Kalirajan
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#9: 3 Weeks Ago

re: jquery pagination problem


this is a page called product_display.php

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. session_start();
  3. include_once('db.php');
  4. include_once('valid-scripts/validateData.php');
  5. error_reporting (E_ALL & ~ E_NOTICE);
  6. ?>
  7. <html>
  8. <head>
  9.         <script src="jquery.js" type="text/javascript"></script>
  10.         <script src="jquery.rating.js" type="text/javascript" language="javascript"></script>
  11.         <link href="jquery.rating.css" type="text/css" rel="stylesheet"/>
  12.         <link rel="stylesheet" type="text/css" href="style.css">
  13.  
  14. <script type="text/javascript">
  15. $(document).ready(function() {
  16.     $("#mobile_brand").change(function() {
  17.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  18.  $("#change").html(data);
  19. });
  20.     });
  21.     $("#property3").change(function() {
  22.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  23.  $("#change").html(data);
  24. });
  25.     });
  26.     $("#property4").change(function() {
  27.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  28.  $("#change").html(data);
  29. });
  30.     });
  31.     $("#property6").change(function() {
  32.                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  33.  $("#change").html(data);
  34. });
  35.     });
  36. });
  37. </script>
  38.  
  39. </head>
  40. <body>
  41. <div id="layout">
  42. <br/>
  43. <?php include_once('menu.php'); ?>
  44. <h2>Mobiles</h2>
  45. <?php
  46. $sql1="select distinct(property1) from mobiles";
  47. $result1=mysql_query($sql1);
  48. $myresult1 = "";
  49. $myresult1 .= "<form name='' method='POST' action=''>";
  50. $myresult1 .= "<select name='mobile_brand' id='mobile_brand'>";
  51. $myresult1 .= "<option value=''>Mobile Brand</option";
  52. while($row1=mysql_fetch_array($result1)){
  53. $myresult1 .= "<option value='".$row1['property1']."'>".$row1['property1']."</option";
  54. }
  55. $myresult1 .= "</select>&nbsp;";
  56.  
  57.         $enumFields = getEnumFieldValues('mobiles', 'property4');
  58.         $myresult1 .=  "<select name='property4' id='property4'>";
  59.         $myresult1 .= "<option value=''>Price</option";
  60.          foreach($enumFields as $value)
  61.                {
  62.                   $myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
  63.                }
  64.         $myresult1 .= "</select>&nbsp;";
  65.  
  66.  
  67.         $enumFields = getEnumFieldValues('mobiles', 'property3');
  68.         $myresult1 .=  "<select name='property3'id='property3'>";
  69.         $myresult1 .= "<option value=''>Type</option";
  70.          foreach($enumFields as $value)
  71.                {
  72.                   $myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
  73.                }
  74. $myresult1 .= "</select>&nbsp;";
  75.  
  76.         $enumFields = getEnumFieldValues('mobiles', 'property6');
  77.         $myresult1 .= "<option value=''></option";
  78.         $myresult1 .=  "<select name='property6' id='property6' >";
  79.         $myresult1 .= "<option value=''>Os</option";
  80.          foreach($enumFields as $value)
  81.                {
  82.                   $myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
  83.   }
  84. $myresult1 .= "</select>";
  85.  
  86. $myresult1 .= "</form>";
  87. $myresult ='';
  88. $myresult .="<div id='change'>";
  89. $myresult .="<table width='100%'>";
  90. $sql2 = "select *  from mobile_master";
  91. $result2 = mysql_query($sql2);
  92. //$myresult .="<tr><td><b>&nbsp;</b></td>";
  93. //$myresult .="<td><b>Description</b></td>";
  94. //$myresult .="<td><b>Overall Rating</b></td>";
  95. //$j = 1;
  96. //while ($row2 = mysql_fetch_array($result2)){
  97. //if($j <= 1){
  98. //$myresult .="<td><b>".$row2['property1_name']."</b></td>";
  99. //$myresult .="<td><b>".$row2['property2_name']."</b></td>";
  100. //}
  101. //$j++;
  102. //}
  103. $myresult .="</tr>";
  104.  
  105. $myresult .="<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>";
  106. $sql="select * from mobiles";
  107. $result=mysql_query($sql);
  108. $i=0;
  109. while($row=mysql_fetch_array($result)){
  110. $sqlr="select overall_rating from mobiles where property1='". $row['property1']."' and property2='". $row['property2']."'";
  111. $resultr=mysql_query($sqlr);
  112. $rating = mysql_fetch_array($resultr);
  113. $myresult .="<tr><td><center>";
  114. if($row['pic'] != ""){
  115. $myresult .= "<a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='picdisplay.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'</img></a><br/>".$row['property1']."&nbsp;". $row['property2'] ;
  116. }
  117. else
  118. {
  119. $myresult .= "<a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='images/no-image.gif' width='50' height='70'</img></a><br/>".$row['property1']."&nbsp;". $row['property2'];
  120. }
  121. $myresult .="</center></td>";
  122.  
  123. /*if($row['description'] != ""){
  124. $myresult .= "<td>" . $row['description']. "</td>";
  125. }
  126. else
  127. {
  128. $myresult .= "<td>&nbsp;</td>";
  129. }*/
  130. //if($rating['overall_rating'] != ""){
  131. $i++;
  132. $myresult .= "<td>";
  133. for($k = 1; $k <= 10; $k++)
  134. {
  135. if($rating['overall_rating'] == $k)
  136. {
  137.         $chk ="checked";
  138. }
  139. else
  140. {
  141.         $chk = "";
  142. }
  143. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk title='". $k." out of 10 ' disabled/>&nbsp;&nbsp;";
  144. }
  145. $myresult .= "</td>";
  146. /*$myresult .= "<td>" . $rating['overall_rating']. "</td>";
  147. }
  148. else
  149. {
  150. $myresult .= "<td>&nbsp;</td>";
  151. }*/
  152. //$myresult .= "<td>" . $row['property1']. "</td>";
  153. //$myresult .= "<td>" . $row['property2']. "</td>";
  154. $myresult .="</tr>";
  155. }
  156. $myresult .="</table>";
  157. $myresult .="</div>";
  158. echo $myresult1;
  159. echo "<br/>";
  160. echo "<br/>";
  161. echo $myresult;
  162. ?>
  163. <br/>
  164. </body>
  165. </html>

and this is mobile_change.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. require_once('db.php');
  3. include_once('valid-scripts/validateData.php');
  4. $_POST=snipExtras($_POST);
  5. $mobile_brand=$_POST['brand'];
  6.  
  7. $price=$_POST['price'];
  8.  
  9. $type=$_POST['type'];
  10.  
  11. $os=$_POST['os'];
  12.  
  13. $build_query = "";
  14.         $add = "";
  15.         $append = "";
  16. if($mobile_brand != "")
  17. {
  18.         $append = "yes";
  19.         $build_query .= " property1 = '" .$mobile_brand ."'";
  20. }
  21. if($price != "")
  22. {
  23.         if($append =="yes")
  24.         {
  25.         $add = "and";
  26.         }
  27.         $append = "yes";
  28.         $build_query .= " $add property4 = '" .$price ."'";
  29. }
  30.  
  31. if($type != "")
  32. {
  33.         if($append =="yes")
  34.         {
  35.         $add = "and";
  36.         }
  37.         $append = "yes";
  38.         $build_query .= " $add property3 = '" .$type ."'";
  39. }
  40.  
  41. if($os != "")
  42. {
  43.         if($append =="yes")
  44.   {
  45.         $add = "and";
  46.         }
  47.         $build_query .= " $add property6 = '" .$os ."'";
  48. }
  49. $myresult ='';
  50. $myresult .="<div id='change'>";
  51. $myresult .="<table  width='100%'>";
  52. $sql2 = "select *  from mobile_master";
  53. $result2 = mysql_query($sql2);
  54. $myresult .="<tr><td><b>&nbsp;</b></td>";
  55. //$myresult .="<td><b>Description</b></td>";
  56. //$myresult .="<td><b>Overall Rating</b></td>";
  57. //$j = 1;
  58. //while ($row2 = mysql_fetch_array($result2)){
  59. //if($j <= 1){
  60. //$myresult .="<td><b>".$row2['property1_name']."</b></td>";
  61. //$myresult .="<td><b>".$row2['property2_name']."</b></td>";
  62. //}
  63. //$j++;
  64. //}
  65. $myresult .="</tr>";
  66. $myresult .="<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
  67. if($build_query != ""){
  68. $sql="select * from mobiles where $build_query ";
  69. $result=mysql_query($sql);
  70. $count = mysql_num_rows($result);
  71.  
  72. if($count > 0){
  73. $sql="select * from mobiles where $build_query ";
  74. $result=mysql_query($sql);
  75. $i=0;
  76. while($row=mysql_fetch_array($result)){
  77. $sqlr="select overall_rating from mobiles where property1='". $row['property1']."' and property2='". $row['property2']."'";
  78. $resultr=mysql_query($sqlr);
  79. $rating = mysql_fetch_array($resultr);
  80.  
  81. $myresult .="<tr>";
  82. if($row['pic'] != ""){
  83. $myresult .= "<td><center><a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='picdisplay.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'</img></a></center><center>". $row['property1']."&nbsp;".$row['property2'] ."</center></td>";
  84. }
  85. else
  86. {
  87. $myresult .= "<td><center><a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='images/no-image.gif' width='50' height='70'</img></a></center><center>". $row['property1']."&nbsp;".$row['property2'] ."</center></td>";
  88. }
  89. /*if($row['description'] != ""){
  90. $myresult .= "<td>" . $row['description']. "</td>";
  91. }
  92. else
  93. {
  94. $myresult .= "<td>&nbsp;</td>";
  95. }*/
  96. /*if($rating['overall_rating'] != ""){
  97. $myresult .= "<td>" . $rating['overall_rating']. "</td>";
  98. }
  99. else
  100. {
  101. $myresult .= "<td>&nbsp;</td>";
  102. }
  103. */
  104. $i++;
  105. $myresult .= "<td>";
  106. for($k = 1; $k <= 10; $k++)
  107. {
  108. if($rating['overall_rating'] == $k)
  109. {
  110.         $chk ="checked";
  111. }
  112. else
  113. {
  114.         $chk = "";
  115. }
  116. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk title='". $k." out of 10 ' disabled/>&nbsp;&nbsp;";
  117. }
  118. $myresult .= "</td>";
  119.  
  120. //$myresult .= "<td>" . $row['property1']. "</td>";
  121. //$myresult .= "<td>" . $row['property2']. "</td>";
  122. $myresult .="</tr>";
  123. }
  124. }
  125. else if($count == 0 && $build_query != ""){
  126. $myresult .= "<tr> <td colspan='5'><p class='message'>Sorry No Product Yet available for Display </p></td></tr>";
  127. }
  128.  
  129. }
  130. else if($build_query == ""){
  131. $sql="select * from mobiles";
  132. $result=mysql_query($sql);
  133. $i=0;
  134. while($row=mysql_fetch_array($result)){
  135. $sqlr="select overall_rating from mobiles where property1='". $row['property1']."' and property2='". $row['property2']."'";
  136. $resultr=mysql_query($sqlr);
  137. $rating = mysql_fetch_array($resultr);
  138.  
  139.  
  140. $myresult .="<tr>";
  141. if($row['pic'] != ""){
  142. $myresult .= "<td><center><a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='picdisplay.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'</img></a></center><center>".$row['property1']."&nbsp;".$row['property2']."</center></td>";
  143. }
  144. else
  145. {
  146. $myresult .= "<td><center><a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='images/no-image.gif' width='50' height='70'</img></a></center><center>". $row['property1']."&nbsp;".$row['property2']."</center></td>";
  147. }
  148. /*if($row['description'] != ""){
  149. $myresult .= "<td>" . $row['description']. "</td>";
  150. }
  151. else
  152. {
  153. $myresult .= "<td>&nbsp;</td>";
  154. }*/
  155. /*if($rating['overall_rating'] != ""){
  156. $myresult .= "<td>" . $rating['overall_rating']. "</td>";
  157. }
  158. else
  159. {
  160. $myresult .= "<td>&nbsp;</td>";
  161.      }
  162. */
  163. $i++;
  164. $myresult .= "<td>";
  165. for($k = 1; $k <= 10; $k++)
  166. {
  167. if($rating['overall_rating'] == $k)
  168. {
  169.         $chk ="checked";
  170. }
  171. else
  172. {
  173.         $chk = "";
  174. }
  175. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk title='". $k." out of 10 ' disabled/>&nbsp;&nbsp;";
  176. }
  177. $myresult .= "</td>";
  178.  
  179.  
  180. //$myresult .= "<td>" . $row['property1']. "</td>";
  181. //$myresult .= "<td>" . $row['property2']. "</td>";
  182. $myresult .="</tr>";
  183. }
  184.  
  185. }
  186. $myresult .="</table>";
  187. $myresult .="</div>";
  188. echo $myresult;
  189.  
  190. ?>
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#10: 2 Weeks Ago

re: jquery pagination problem


i am using jquery something like this
Expand|Select|Wrap|Line Numbers
  1. # <script type="text/javascript">
  2. # $(document).ready(function() {
  3. #     $("#mobile_brand").change(function() {
  4. #                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  5. #  $("#change").html(data);
  6. # });
  7. #     });
  8. #     $("#property3").change(function() {
  9. #                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  10. #  $("#change").html(data);
  11. # });
  12. #     });
  13. #     $("#property4").change(function() {
  14. #                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  15. #  $("#change").html(data);
  16. # });
  17. #     });
  18. #     $("#property6").change(function() {
  19. #                 $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
  20. #  $("#change").html(data);
  21. # });
  22. #     });
  23. # });
  24. # </script>
  25. #  
to filter using the drop downs!!!! but when paginations of these filtered values the filtration is going off and it will show the all the values!! how to achieve pagination of filtered values?? or which is the best way to use jquery for this purpose!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#11: 2 Weeks Ago

re: jquery pagination problem


Haven't looked at your code in detail, but perhaps the problem lies in the fact that you're setting the element with ID "change" to include another element with ID "change".

PS. threads merged. Please do not double post.
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#12: 2 Weeks Ago

re: jquery pagination problem


the 1st problem was different from the second so posted it again with different name sorry .

so how exactly is the way to solve the problem .

my need is like .

there are 4 dropdowns depending on which the respective entries from DB must be selected . and pagination is also required ..
will jquery be helpful for this ?
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#13: 2 Weeks Ago

re: jquery pagination problem


i cld solve the pagination problem by using the form $_GET and stuff !! but the original problem which i posted 1st still remains!!can any one plz look at code and help me ??
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#14: 2 Weeks Ago

re: jquery pagination problem


You have the following line:
Expand|Select|Wrap|Line Numbers
  1.  $("#change").html(data);
This sets the element "change" to the response of the Ajax request to mobile-change.php.

In that PHP file, the response includes this line:
Expand|Select|Wrap|Line Numbers
  1. $myresult .="<div id='change'>";
which means multiple duplicate IDs. Either remove this line or make the ID unique.
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#15: 2 Weeks Ago

re: jquery pagination problem


oh okie!! i thought it will replace the element with ID change with the data in mobile_change.php ..... so added it ....

hey i checked the source code ...the ID "change" is there only 1 time after the jquery has also executed !
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#16: 2 Weeks Ago

re: jquery pagination problem


the exact problem is that the starts which are replacing the radio buttons in not appearing once the jquery is executed !! but when the 1st time page loads the starts are appearing !!! i just repeated my problem to be clear!
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#17: 2 Weeks Ago

re: jquery pagination problem


I've had a quick look at the code and I think I see where the problem might be. When you load the page, the code runs, so the page is updated, but when you make an update, you need to re-run the code to convert the radio buttons back to stars. Here's the code which you can try:
Expand|Select|Wrap|Line Numbers
  1. $('input[type=radio].star').rating();
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#18: 2 Weeks Ago

re: jquery pagination problem


okie that piece of code worked ... i need a small help ...i am trying to display the value when he/she clicks on the stars . but the onclick is not working .

the webisite had given some code to alert the star rate

Expand|Select|Wrap|Line Numbers
  1. $('.auto-submit-star').rating({
  2.   callback: function(value, link){
  3.     alert(value);
  4.   }
  5. });

but its not working .. help on this !
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#19: 2 Weeks Ago

re: jquery pagination problem


That's probably because '.auto-submit-star' should be '.star'
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#20: 2 Weeks Ago

re: jquery pagination problem


nope i replaced it with star only !!! the stars are appearing but when i click on any star the the alert is not coming

i just modified the code like

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. $(function(){
  3. $('input[type=radio].star').rating({
  4.   callback: function(value, link){
  5.    alert("yes");
  6.   }
  7.  });
  8. });</script>
  9.  
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#21: 2 Weeks Ago

re: jquery pagination problem


the entire (small piece concerning it )
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. $(function(){
  3. $('input[type=radio].star').rating({
  4.   callback: function(value, link){
  5.    alert("yes");
  6.   }
  7.  });
  8. });</script>
  9.  
  10. <?php
  11. for ($i = 1 ; $i < $count; $i++){
  12. if($row2['rating'.$i.'_name']){
  13. $myresult .= "<tr><td>";
  14. $indfeature = 0;
  15. $indfeature = getindividualrating(rating.$i,$brand,$model);
  16. $myresult .= $row2['rating'.$i.'_name']." (".round($indfeature) .")<br/><br/>";
  17. $myresult .= "</td>";
  18. $myresult .= "<td>";
  19. $myresult .= "<div class='Clear'>";
  20. if($user != "")
  21.         {
  22.                 $tocheck = $ratingchk[$i];
  23.         }
  24.         else
  25.         {
  26.                 $tocheck = round($indfeature);
  27.         }
  28. for($k = 1; $k <= 10; $k++){
  29. if($tocheck == $k){
  30. $chk = "checked";
  31. }
  32. else
  33. {
  34. $chk = "";
  35. }
  36. $myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk $disabled title='". $k." out of 10 ' onclick=\" return sayvalue(this);\"/>&nbsp;&nbsp;";
  37. }
  38. $myresult .= "<span id='current-rating".$i."'> </span>";
  39. $myresult .= "</div>";
  40. $myresult .= "</td>";
  41. $myresult .= "</tr>";
  42. }
  43. }
  44.  
  45.  
pradeepjain's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: India
Posts: 407
#22: 1 Week Ago

re: jquery pagination problem


is there something wrong in code that i need to change ?
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#23: 1 Week Ago

re: jquery pagination problem


Can you post a link to a test page? If not, post the HTML code.
Reply