首页 > Web开发 > 详细

HTML Table to Json

时间:2018-12-26 17:38:27      阅读:151      评论:0      收藏:0      [点我收藏+]

HTML 表格输出JSON

技术分享图片

     <table class="table table-striped table-bordered table-hover dataTable no-footer" id="boltAreaDetailType" role="grid" aria-describedby="sample_2_info">
                                    <thead>
                                        <tr>
                                            <td data-override="BoltName" >螺栓型号</td>
                                            <td data-override="BoltType">螺栓规格</td>
                                            <td data-override="Num">数量</td>
                                            <td>操作</td>
                                        </tr>
                                    </thead>
                                    <tbody id="tableBoltAreaTypeBody"></tbody>
                                </table>
    var table = $(‘#boltAreaDetailType‘).tableToJSON({
        extractor: {
            0: function (cellIndex, $cell) {
                return $cell.find(‘option:selected‘).val();
            },
            1: function (cellIndex, $cell) {
                return $cell.find(‘option:selected‘).val();
            },
            2: function (cellIndex, $cell) {
                return $cell.find(‘input[type=number]‘).val();
            }
        },
        ignoreColumns: [3]
    });

 技术分享图片

 

HTML Table to Json

原文:https://www.cnblogs.com/w2011/p/10180208.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!