将标记添加到html表可点击事件

时间:2016-04-18 17:19:43

标签: c# jquery html

我有这张桌子

填写c#为

foreach (Complains complainobj in lstrequest)
{
    info += @"<tr> ";
    info += @"<td '><strong>" + complainobj.ComplainId.ToString() + "</strong></td>";
    info += @"<td '><strong>" + donorname + "</strong></td>";
    info += @"<td '><strong> " + complainobj.ComplainDetails + "</strong></td>";
    info += @"<td '><strong>" + complainobj.ComplainTitle + "</strong></td>";
    info += @"<td '><div id='ComplainStatusID' style='float:right;display:block;'>"+
    "<strong>" + complainobj.ComplainStatus + "</strong></div>"+
    "<div id='ComplainStatusinputID' style='float:right;display:none;'>" +
    "<input id='editstatus' type='text'/></div>"
        + "<div style='float:left;'><a href='javascript:void(0)'  class='editstatusclass'> <span class='glyphicon glyphicon-pencil'></span></a></td>";
    info += @"<td '><strong>" + complainobj.CompainNotes + "</strong></td>";
    info += @"<td '><strong>" + complaintype + "</strong></td>"; 
    info += @"</tr>";
}

当我添加如图所示的标签并尝试将其处理为

$("a.editstatusclass").on("click", function () {
   $("#ComplainStatusID").css('display', 'none');
   $("#ComplainStatusinputID").css('display', 'block');
});

$("#editstatus").blur(function () {
   var compainId = $(this).parent().parent().siblings(":first").text();
   alert(compainId)
});

每次点击第一行 我已经需要它为每一行创建一个标签并获得html DATA ROW值

1 个答案:

答案 0 :(得分:1)

from import_export import resources
class UserResource(resources.ModelResource):
    def before_import(self,dataset, dry_run, **kwargs):
        #dataset is  tablib.Dataset()
        for i in dataset:
            i[1]=make_password(i[1])
        return super(UserResource, self).before_import(dataset, dry_run, **kwargs)