简体   繁体   English

处于子级tr(响应模式)时,数据表编辑器的InTableControl按钮不起作用

[英]InTableControl buttons of datatable editor not working when in child tr (responsive mode)

I'm using datatable editor with inTableControl buttons. 我正在使用带有inTableControl按钮的数据表编辑器。 The inTableControl buttons work fine when the table is in normal status, but in combination with responsive and if the inTableControl buttons are in the child tr (when collapsed in the dropdown), the sample js is not working. 当表处于正常状态时,inTableControl按钮可以正常工作,但与响应结合使用,并且如果inTableControl按钮位于子tr中(在下拉菜单中折叠时),则示例js无法正常工作。 There are no records to edit in the modal. 模式中没有要编辑的记录。 Does anyone know how to adjust the js for the inTableControl buttons for them also to work when in the child tr? 有谁知道如何调整inTableControl按钮的js,使其在子tr中也能正常工作? I tried a couple of things like .parent().prev('parent') , .closest('tr.child').prev('tr.parent'), .closest('tr').prev('tr') , .parent().prev('tr') .... but none of them work. 我尝试了一些事情,例如.parent()。prev('parent'),.closest('tr.child')。prev('tr.parent'),.closest('tr')。prev('tr '),.parent()。prev('tr')....但它们都不起作用。 And do I need an if for both status? 我是否需要两种身份都可以? How would that look like? 看起来怎么样?

This works fine ... 这很好用...

var edit_inTable_editor_bafin = $('#bafin').on('click', 'a.editor_cog', function (e) {
    e.preventDefault();

    editor_bafin.edit( $(this).closest('tr'), {
        title: 'Edit record',
        buttons: 'Update'
    } );

} );

<tr id="row_2812" class="odd selected parent" role="row">
 <td>Test</td>
 <td class=" datatable-link" style="">
  <a class="editor_cog" title="Edit Entity" role="button" href="">
 </td>
</tr>

... but when the inTableControl buttons are in child tr (dropdown of responsive): ...但是当inTableControl按钮位于子tr中时(响应下拉菜单):

<tr id="row_2812" class="odd selected parent" role="row">
<tr class="child">
 <td class="child" colspan="15">
  <ul data-dtr-index="0">
   <li data-dtr-index="11">...</li>
   <li data-dtr-index="12">...</li>
   <li data-dtr-index="13">...</li>
    <span class="dtr-title"></span>
    <span class="dtr-data">
     <a class="editor_cog" title="Edit Entity" role="button" href="">Edit</a>
    </span>
   </li>
  </ul>
 </td>
</tr>

... ...

I have a similar problem. 我有一个类似的问题。 But I solved it this way 但是我这样解决了

 $('#tb_sos tbody').on( 'click', 'input.aja', function () {

        var tr=$(this).parents('tr');
        if ($(tr).hasClass("child")){
          var api = tablaSOS.tabla.row( $(this).parents('tr').prev('tr') ).data();
        }else{
          var api = tablaSOS.tabla.row( $(this).parents('tr') ).data();
        }
        console.log(api);

  } );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM