开发者

Adding a table column using jquery and the new column should be the first column

Thanks for all yor help. My requrirement is to prepend the column to a row with image. But my image is moving all the columns to the right. How to add image to only matching rows but not moving other columns to right. Iam attaching my screenshot here. Please help me.

Adding a table column using jquery and the new column should be the first column

Thanks,

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="http://dlglobal.dl.com/Admin/开发者_如何学JAVAIT/operations/Documents/jquery.SPServices-0.5.8.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function()
{
//alert("alert test");
/*$Textsql = $("td.ms-vb2:contains('Budakov')"); 
$Textsql.css("background-color", "#461B7E"); */


$().SPServices({
  operation: "GetListItems",
  async: false,  
  listName: "OnCallList",

  completefunc: function (xData, Status) {
    //alert(xData.responseXML.xml);
$("#ctl00_m_g_87fe292c_7976_4ad4_bf5c_3c1ecf08b2d8_AdvancedDataGrid tr:first").append("<th></th>");

    $(xData.responseXML).find("[nodeName=z:row]").each(function() {     

     var TextList=$(this).attr("ows_Title");
     $Textsql = $("td.ms-vb2:contains('" + TextList.toString() + "')");

     $Textsql.parent().prepend("<td class='ms-vb2'><img src='http://dlglobal.dl.com/Admin/IT/operations/PublishingImages/OnCall.png' /></td>");  });
}
});
});
</script>


Set a fixed with on the TD and add it to every row. Then only populate that TD with the image for the selected rows. This way that column will always be the width of the image whether or not it is present.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜