根据类从一个表中提取行,而仅将少量行提供给另一表-JQUERY / ANGULARJS

时间:2018-11-13 09:29:30

标签: jquery angularjs bootstrap-modal

我有一张桌子,其中的表行是通过angularjs填充的。

<table id="botRecordTable" st-table="display_bot_records" st-safe-src="botData" ng-show="botData" class="table table-bordered table-striped shadow p-3 mb-5 bg-white rounded" ng-controller="mdmBotRulesController">
   <thead class="thead-dark">
      <tr style="color: #fff; background-color: #212529; border-color: #32383e;">
         <th>CASE NO</th>
         <th>MATCH CODE</th>
         <th>RULE</th>
         <th>EMAIL</th>
         <th>DOB</th>
         <th>GENDER</th>
      </tr>
   </thead>
   <tbody>
      <tr valign="middle" st-select-row="row" st-select-mode="multiple" ng-repeat="row in display_bot_records">
         <td>{{$index + 1}}</td>
         <td align="left" ng-bind="row.matchcode"></td>
         <td>
            <select id="ruleChangeSelect" ng-change="botRuleChanged(botDecision)" class="custom-select" style="margin-left:0px; width:auto" ng-model="botDecision" ng-options="choice.name for choice in botDecisions">
            </select>
         </td>
         <td ng-bind="row.email"></td>
         <td ng-bind="row.dob"></td>
         <td ng-bind="row.gender"></td>
      </tr>
   </tbody>
</table>

在更改下拉列表时,我向选择下拉列表中添加了一个 highlightSelect 类,它工作得很好。

现在我的模态中有另一个表:

<table id="botRuleModalTable" ng-controller="botRulesController">
   <thead>
      <tr style="font-size:0.8rem !important">
         <th>CASE NO</th>
         <th>MATCH CODE</th>
         <th>FROM RULE</th>
         <th>TO RULE</th>
      </tr>
   </thead>
   <tbody>
      <tr>
         <td></td>
         <td></td>
         <td></td>
         <td></td>
      </tr>
   </tbody>
</table>

我需要获取具有类boostlightSelect的botRecordTable行,并将这些行(CASE NO和MATCH CHODE)中的仅有几行提供给botRuleModalTable。

到目前为止我尝试过的事情

if($("botRecordTable").hasClass("highlightSelect")) (function() { 
    var html = $(this).closest("tr").clone().find('td:last').remove().end().prop('outerHTML');
    $("#botRuleModalTable").append(html);
});

上面的代码没有将行应用于新表。

有人可以帮忙吗?

0 个答案:

没有答案