如何使用jquery

时间:2015-11-02 12:29:51

标签: javascript jquery gsp

enter image description here

点击第二栏点击我正在调用方法

function getListOfList(primaryId, isFlat, col) {
        alert(primaryId)
        $.ajax({
            url : ("/" + serverURL + "/dataGrid/getChilds"),
            type : "POST",
            data : {
                primaryId : primaryId,
                isFlat : isFlat,
                column : col
            },
            success : function(result) {
                                }
        });
    }

这将返回

returnMap as JSON ==========================[statusFlag:SUCCESS, data:[[<a onclick="viewEmpDetails('56374e74f45f064d33b57583','false','UniqueId')" title='View' style='cursor:pointer'><i class='ace-icon fa fa-search-plus grey' style='width:30px;'> </i></a>, <a onclick="getChilds('8','false','UniqueId')" title='View' style='cursor:pointer'><i class='ace-icon fa fa-search-plus grey' style='width:30px;'> </i></a>   Bhagyawan, 02/02/49, 02/08/81, 15/02/1836, 15-Jan-2012, 10-Feb-25]]]

结果的数据部分实际上是行数据。 ,其中包含两行数据,可能为三行,具体取决于查询,我需要在下方添加点击行。

我正在动态创建表

<div class="row">
        <div class="col-xs-12">

            <table id="data-grid-table-tree" class="datasetTable">
              <tr>
                    <th>View</th>
                    <th align="left">${session.data}</th>
                    <g:if test="${session.fieldsToFetch }">
                    <g:each in="${session.fieldsToFetch}"  var="column">
                        <th >${column }</th>

                    </g:each>
                    </g:if>
                                      </tr>
              <tr>
                   <g:each in="${session.treeGridJsonObject}"  var="lists">
                    <tr align="left">
                        <g:each in="${lists}"  var="list">
                               <td align="left">${raw(list)}</td>

                        </g:each>
                    </tr>
                   </g:each>              

            </table>

任何人都有帮助!

1 个答案:

答案 0 :(得分:0)

<table border="2">
    <tr><td>test1</td></tr>
     <tr><td>test1</td></tr>
     <tr><td>test1</td></tr>
</table>


$(document).ready(function(){
    $('table tr:nth-child(1)').after('<tr><td>test2</td></tr>');
});

$('table tr:nth-​​child(1)') - 将此作为您选择的行。

将结果记录转换为表格行html,然后使用上面的代码附加表格行。

jsfiddle