javascript - table's columns width changes after adding another page to tr using ajax -
i have problem kinda hard explain hope understand , me, have table produce rows dynamically, when row pressed shows page containing information, problem when press on row , info page shown columns width changed , entire table shifts(all widths). have noticed happens after info page loaded cant figure out why...
code: post table:
echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" align=\"center\" class=\"result_table\" id=\"result_table\"> <tr align=\"right\" bgcolor=\"red\"> <th bgcolor=\"#cccccc\" align=\"right\" >עיר</th> <th bgcolor=\"#cccccc\" >רחוב</th> <th bgcolor=\"#cccccc\" >מספר בית</th> <th bgcolor=\"#cccccc\" >מחיר</th> </tr>"; foreach($types $data){ echo $data['id']; echo "<tr onclick=\"waiting_for_post(".$data['id'].");\" class=\"search_row\">"; echo "<td align=\"right\" width=\"25%\">"; echo $data['city']; echo "</td>"; echo "<td align=\"right\">"; echo $data['street']; echo "</td>"; echo "<td align=\"right\">"; echo $data['house']; echo "</td>"; echo "<td align=\"right\">"; echo $data['price']; echo "</td></tr>"; echo "<tr class=\"info_row\" style=\"width:100%\"><td colspan=\"4\"><div id=\"div_num_".$data['id']."\" style=\"height:0px\" ></div></td></tr>"; function waiting_for_post(apart_id){ var div = document.getelementbyid("div_num_"+apart_id) var xmlhttp = createxmlhttprequestobject(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { var responsetext = xmlhttp.responsetext; div.innerhtml = responsetext; div.style.visibility = 'visible'; div.style.height= "225px"; div.style.width="100%"; } } xmlhttp.open("get","publish_data.php?id="+apart_id,true); xmlhttp.send(); }
the width of column change content, because set "width:100%", use fixed width may solve problem, , try estimate max width.
Comments
Post a Comment