其中包括复选框和可编辑

问题描述:

我正在使用ajax调用我的web服务&在表数据中显示Json值。现在客户想要在每一行中编辑数据,从而点击复选框。其中包括复选框和可编辑

一旦单击复选框,该行应该是可编辑的。请帮助我在下面的代码中包括复选框的位置。

$.ajax({ 
    type: "GET", //GET or POST or PUT or DELETE verb 
    url: "http://localhost:8080/karthi/", // Location of the service 
    success: function (json) {//On Successfull service call 

    var txtStr = '<table class="datatable"><thead><tr> <th>id</th> <th>firstName</th> <th>lastName</th> <th>licenseId</th> <th>telephone</th> <th>email</th> </tr></thead><tbody>'; 

    for(var i = 0; i < json.length; i++) { 

    txtStr += '<tr class="gradeA"> <td><a class="edit_row" href="#tab2" onclick="showDetails(\''+json[i].id+'\');">'+json[i].id+'</a></td> <td>'+json[i].firstName+'</td> <td>'+json[i].lastName+'</td> <td>'+json[i].licenseId+'</td> <td>'+json[i].telephone+'</td> <td>'+json[i].email+'</td> </tr>'; 

将它包含在showDetails()中。 把它作为id字段之前的第一列。 标签内有复选框的新标题

+0

感谢您的回复。我在thead里添加了标题,但是我需要每行中的复选框。因此,用户可以单击复选框并使该行可编辑 – Karthick88it 2013-03-17 15:52:45

+0

@ Karthick88it具有单选按钮:'code''code'在showDetails()中有这个代码。看起来你的代码在这个函数中创建行 – 2013-03-17 16:45:11