HTML Table to Json


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]
    });

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM