0

我正在使用 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>';
4

1 回答 1

0

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

于 2013-03-17T15:43:07.243 回答