如何合并 jQuery 数据表 excelHtml5 中列的匹配值

2024-04-27

当我从数据表导出 Excel 时,我无法合并 col 值。由于列的值B named Category。需要合并重复值。我是编程新手,感谢任何帮助

这是我的我的jsfiddle https://jsfiddle.net/t1j6rzg8/2/

这是我的代码

<table id="example1" class="table table-sm cell-border compact stripe table-bordered table-hover dataTable dtr-inline"
    cellspacing="0" width="100%" aria-describedby="example1_info">


    <thead>
        <tr>
            <th class="d-none sorting_disabled" rowspan="1" colspan="1">Date</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Category</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Item Name</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Price</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Opening</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Recived</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Total</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Closing</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Sales</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Total</th>
        </tr>
    </thead>

    <tbody>

        <tr data-row-id="1761" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Golden Touch Brandy 180ml">Golden Touch Brandy 180ml</td>
            <td class="editable-col" col-index="2" oldval="250.00">250.00</td>
            <td class="editable-col" col-index="3" oldval="9.00">9.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="9">9</td>
            <td class="editable-col" col-index="6" oldval="9.00">9.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1763" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Golden Touch Brandy 750ml">Golden Touch Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="1000.00">1000.00</td>
            <td class="editable-col" col-index="3" oldval="3.00">3.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="3">3</td>
            <td class="editable-col" col-index="6" oldval="3.00">3.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
    
        <tr data-row-id="1948" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Whytehall Brandy 180ml">Whytehall Brandy 180ml</td>
            <td class="editable-col" col-index="2" oldval="250.00">250.00</td>
            <td class="editable-col" col-index="3" oldval="18.00">18.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="18">18</td>
            <td class="editable-col" col-index="6" oldval="18.00">18.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1949" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Whytehall Brandy 750ml">Whytehall Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="1000.00">1000.00</td>
            <td class="editable-col" col-index="3" oldval="4.00">4.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="4">4</td>
            <td class="editable-col" col-index="6" oldval="4.00">4.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1992" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Roulette Brandy 750ml">Roulette Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="2230.00">2230.00</td>
            <td class="editable-col" col-index="3" oldval="1.00">1.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="1">1</td>
            <td class="editable-col" col-index="6" oldval="1.00">1.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="2048" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Bejois VSOP 375ML">Bejois VSOP 375ML</td>
            <td class="editable-col" col-index="2" oldval="200.00">200.00</td>
            <td class="editable-col" col-index="3" oldval="20.00">20.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="20">20</td>
            <td class="editable-col" col-index="6" oldval="20.00">20.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
  
    </tbody>


    <tfoot>

        <tr>
            <th class="d-none" rowspan="1" colspan="1">0</th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"> 1900</th>
            <th rowspan="1" colspan="1"> 9</th>
            <th rowspan="1" colspan="1"> 1909</th>
            <th rowspan="1" colspan="1"> 1909</th>
            <th rowspan="1" colspan="1"> 0</th>
            <th rowspan="1" colspan="1"> 0</th>
        </tr>
    </tfoot>


 
</table>

我的 JavaScript

 $(document).ready(function () {

        document.title = 'shop';
        $('#example1').DataTable({
            "processing": true,
            "dom": 'Bfrtip',
            "lengthChange": false,
            "searching": false,
            "info": true,
            "autoWidth": false,
            "responsive": true,
            "retrieve": true,
            "paging": false,
            "lengthMenu": [
                [-1],
                ["All"]
            ],
            "bSort": false,
            "bLengthChange": false,

            "buttons": ["copy", {
                    extend: 'excelHtml5',
                    footer: true,
                    text: 'Save as Excel',
                    pageSize: 'A4',
                      customize: function (xlsx) {
                        var sheet = xlsx.xl.worksheets['sheet1.xml'];
                        $('c[r=C1] t', sheet).text('Sudha Wines');
                        $('row:first c', sheet).attr('s', '32');

                        var col = $('col', sheet);
                        $(col[0]).attr('width', 8);
                        $(col[1]).attr('width', 24);
                        $(col[2]).attr('width', 9);
                        $(col[3]).attr('width', 8);
                        $(col[4]).attr('width', 7);
                        $(col[5]).attr('width', 8);
                        $('row* ', sheet).each(function (index) {
                            if (index > 0) {
                                $(this).attr('ht', 26);
                                $(this).attr('customHeight', 1);
                            }
                        });






                    },
                    
                  
                }
            ],


        });
    });

output i'am getting in MS excel enter image description here

我想要的期望输出是


Excel 使用的 OpenXML 电子表格格式指定合并范围,如下所示:

<mergeCells  count="2">
    <mergeCell ref="B2:B5"/>
    <mergeCell ref="B6:B7"/>
</mergeCells>

上面表示工作表中的 2 个合并范围。

因此,我们需要添加逻辑来扫描“类别”列中的数据,以确定我们需要创建哪些范围。一旦我们有了这些范围,我们就可以构建上面的 Excel XML 片段,并在导出过程中将其插入到工作表中。

你已经拥有了你的customize: function (xlsx) { ... },所以我们可以在那里添加我们的逻辑:

var ranges = buildRanges(sheet);
                        
// build the HTML string:
var mergeCellsHtml = '<mergeCells count="' + ranges.length + '">';
ranges.forEach(function(range) {
    mergeCellsHtml = mergeCellsHtml + '<mergeCell ref="' + range + '"/>';
})
mergeCellsHtml = mergeCellsHtml + '</mergeCells>';

$( 'sheetData', sheet ).after( mergeCellsHtml );
// don't know why, but Excel auto-adds an extra mergeCells tag, so remove it:
$( 'mergeCells', sheet ).last().remove();

建立范围的工作是在buildRanges(sheet)功能。我希望这段代码可以被简化/改进,但它显示了总体方法:

function buildRanges(sheet) {

  let prevCat = ''; // previous category
  let currCat = ''; // current category
  let currCellRef = ''; // current cell reference
  let rows = $('row', sheet);
  let startRange = '';
  let endRange = '';
  let ranges = [];

  rows.each(function (i) {
    if (i > 0 && i < rows.length) { // skip first (headings) row
      let cols = $('c', $(this));
      cols.each(function (j) {
        if (j == 1) { // the "Category" column
          currCat = $(this).text(); // current row's category
          currCellRef = $(this).attr('r'); // e.g. "B3"
          if (currCat !== prevCat) {
            if (i == 1) {
              // start of first range
              startRange = currCellRef;
              endRange = currCellRef;
              prevCat = currCat;
            } else {
              // end of previous range
              if (endRange !== startRange) {
                // capture the range:
                ranges.push( startRange + ':' + endRange );
              }
               // start of a new range
              startRange = currCellRef;
              endRange = currCellRef;
              prevCat = currCat;
            }
          } else {
            // extend the current range end:
            endRange = currCellRef;
          }
          //console.log( $(this).attr('r') );
        }
      });
      if (i == rows.length -1 && endRange !== startRange) {
        // capture the final range:
        ranges.push( startRange + ':' + endRange );
      }
    }
  });
  return ranges;
}

此函数会扫描您的类别列,查找该列中的值何时发生变化。

它假设值已经排序/分组,以支持这一点。


一项重要说明

我将以下行添加到您的按钮逻辑中:

title: '', // no title row in excel sheet

这可确保电子表格尚未创建任何合并单元格区域。如果你想要这个功能,那么我的逻辑就需要调整,因为已经有一个<mergeCells>电子表格中的标签(在第一行,包含标题)。


最终结果看起来像这样:

以下是一个演示中的所有部分(不确定您是否可以实际从堆栈片段中运行 Excel 下载):

  $(document).ready(function () {

        document.title = 'shop';
        $('#example1').DataTable({
            "processing": true,
            "dom": 'Bfrtip',
            "lengthChange": false,
            "searching": false,
            "info": true,
            "autoWidth": false,
            "responsive": true,
            "retrieve": true,
            "paging": false,
            "lengthMenu": [
                [-1],
                ["All"]
            ],
            "bSort": false,
            "bLengthChange": false,

            "buttons": ["copy", {
                    extend: 'excelHtml5',
                    footer: true,
                    text: 'Save as Excel',
                    title: '', // no title row in excel sheet
                    pageSize: 'A4',
                      customize: function (xlsx) {
                        var sheet = xlsx.xl.worksheets['sheet1.xml'];
                        
                        $('row:first c', sheet).attr('s', '32');

                        var col = $('col', sheet);
                        $(col[0]).attr('width', 8);
                        $(col[1]).attr('width', 24);
                        $(col[2]).attr('width', 9);
                        $(col[3]).attr('width', 8);
                        $(col[4]).attr('width', 7);
                        $(col[5]).attr('width', 8);
                        $('row* ', sheet).each(function (index) {
                            if (index > 0) {
                                $(this).attr('ht', 26);
                                $(this).attr('customHeight', 1);
                            }
                        });

                        var ranges = buildRanges(sheet);
                        
                        // build the HTML string:
                        var mergeCellsHtml = '<mergeCells count="' + ranges.length + '">';
                        ranges.forEach(function(range) {
                            mergeCellsHtml = mergeCellsHtml + '<mergeCell ref="' + range + '"/>';
                        })
                        mergeCellsHtml = mergeCellsHtml + '</mergeCells>';

                        $( 'sheetData', sheet ).after( mergeCellsHtml );
                        // don't know why, but Excel auto-adds an extra mergeCells tag, so remove it:
                        $( 'mergeCells', sheet ).last().remove(); 



                    }
                    
                  
                }
            ]


        });
    });
    
function buildRanges(sheet) {

  let prevCat = ''; // previous category
  let currCat = ''; // current category
  let currCellRef = ''; // current cell reference
  let rows = $('row', sheet);
  let startRange = '';
  let endRange = '';
  let ranges = [];

  rows.each(function (i) {
    if (i > 0 && i < rows.length) { // skip first (headings) row
      let cols = $('c', $(this));
      cols.each(function (j) {
        if (j == 1) { // the "Category" column
          currCat = $(this).text(); // current row's category
          currCellRef = $(this).attr('r'); // e.g. "B3"
          if (currCat !== prevCat) {
            if (i == 1) {
              // start of first range
              startRange = currCellRef;
              endRange = currCellRef;
              prevCat = currCat;
            } else {
              // end of previous range
              if (endRange !== startRange) {
                // capture the range:
                ranges.push( startRange + ':' + endRange );
              }
               // start of a new range
              startRange = currCellRef;
              endRange = currCellRef;
              prevCat = currCat;
            }
          } else {
            // extend the current range end:
            endRange = currCellRef;
          }
          //console.log( $(this).attr('r') );
        }
      });
      if (i == rows.length -1 && endRange !== startRange) {
        // capture the final range:
        ranges.push( startRange + ':' + endRange );
      }
    }
  });
  return ranges;
}
<!doctype html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Demo</title>

  <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/1.10.23/js/jquery.dataTables.min.js"></script>
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.23/css/jquery.dataTables.min.css"/>

  <link rel="stylesheet" type="text/css" href="https://datatables.net/media/css/site-examples.css">

  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.6.5/css/buttons.dataTables.min.css"/> 
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jszip/2.5.0/jszip.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/pdfmake.min.js"></script>
  <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.36/vfs_fonts.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/dataTables.buttons.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.colVis.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.flash.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.html5.min.js"></script>
  <script type="text/javascript" src="https://cdn.datatables.net/buttons/1.6.5/js/buttons.print.min.js"></script>

</head>

<body>

<div style="margin: 20px;">

    <table id="example1" class="table table-sm cell-border compact stripe table-bordered table-hover dataTable dtr-inline"
    cellspacing="0" width="100%" aria-describedby="example1_info">


    <thead>
        <tr>
            <th class="d-none sorting_disabled" rowspan="1" colspan="1">Date</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Category</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Item Name</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Price</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Opening</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Recived</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Total</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Closing</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Sales</th>
            <th class="sorting_disabled" rowspan="1" colspan="1">Total</th>
        </tr>
    </thead>

    <tbody>

        <tr data-row-id="1761" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Golden Touch Brandy 180ml">Golden Touch Brandy 180ml</td>
            <td class="editable-col" col-index="2" oldval="250.00">250.00</td>
            <td class="editable-col" col-index="3" oldval="9.00">9.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="9">9</td>
            <td class="editable-col" col-index="6" oldval="9.00">9.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1763" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Golden Touch Brandy 750ml">Golden Touch Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="1000.00">1000.00</td>
            <td class="editable-col" col-index="3" oldval="3.00">3.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="3">3</td>
            <td class="editable-col" col-index="6" oldval="3.00">3.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
    
        <tr data-row-id="1948" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Whytehall Brandy 180ml">Whytehall Brandy 180ml</td>
            <td class="editable-col" col-index="2" oldval="250.00">250.00</td>
            <td class="editable-col" col-index="3" oldval="18.00">18.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="18">18</td>
            <td class="editable-col" col-index="6" oldval="18.00">18.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1949" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Brandy</th>
            <td class="editable-col" col-index="2" oldval="Whytehall Brandy 750ml">Whytehall Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="1000.00">1000.00</td>
            <td class="editable-col" col-index="3" oldval="4.00">4.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="4">4</td>
            <td class="editable-col" col-index="6" oldval="4.00">4.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="1992" class="odd">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Port</th>
            <td class="editable-col" col-index="2" oldval="Roulette Brandy 750ml">Roulette Brandy 750ml</td>
            <td class="editable-col" col-index="2" oldval="2230.00">2230.00</td>
            <td class="editable-col" col-index="3" oldval="1.00">1.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="1">1</td>
            <td class="editable-col" col-index="6" oldval="1.00">1.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
        <tr data-row-id="2048" class="even">
            <td class="editable-col d-none" col-index="0" oldval="2022-08-07">2022-08-07</td>
            <th class="editable-col dtr-control" col-index="1" oldval="Brandy" tabindex="0">Port</th>
            <td class="editable-col" col-index="2" oldval="Bejois VSOP 375ML">Bejois VSOP 375ML</td>
            <td class="editable-col" col-index="2" oldval="200.00">200.00</td>
            <td class="editable-col" col-index="3" oldval="20.00">20.00</td>
            <td class="editable-col" col-index="4" oldval=""></td>
            <td class="editable-col" col-index="5" oldval="20">20</td>
            <td class="editable-col" col-index="6" oldval="20.00">20.00</td>
            <td class="editable-col" col-index="7" oldval="0">0</td>
            <td class="editable-col" col-index="8" oldval="0">0</td>
        </tr>
  
    </tbody>


    <tfoot>

        <tr>
            <th class="d-none" rowspan="1" colspan="1">0</th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"></th>
            <th rowspan="1" colspan="1"> 1900</th>
            <th rowspan="1" colspan="1"> 9</th>
            <th rowspan="1" colspan="1"> 1909</th>
            <th rowspan="1" colspan="1"> 1909</th>
            <th rowspan="1" colspan="1"> 0</th>
            <th rowspan="1" colspan="1"> 0</th>
        </tr>
    </tfoot>


 
</table>

</div>



</body>
</html>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何合并 jQuery 数据表 excelHtml5 中列的匹配值 的相关文章

  • 从 json 创建下拉列表

    我有一个这种形式的 json COLUMNS ID Name DATA 1 Joe 2 Sam 3 Doug 我正在寻找一个如何在 javascript 中从该数据创建下拉列表的示例 但 json dropdown 列表的所有示例 json
  • 如何在 jQuery/javascript 中获取边框宽度

    如何解析边框宽度 style border solid 1px black 在 jQuery javascript 中 elem css border width 不这样做 注意我需要解析 css 的宽度 因为元素可能是display no
  • 规则和夏令时

    我在用着rrule https github com jakubroztocil rrule在我的数据库中创建和存储事件 一切正常 直到我发现我的重复事件与 3 月 31 日之后有一个小时的差异 在法国 这一天我们进行夏令时更改 实际上 我
  • PHP 5 的 HTML 表单库 [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我正在寻找一个QuickForm替代品 QF 存在性能问题 例如组合框中的许多选项 我还想要一些更面向对象的东西 比如 Zend Form
  • Angular Material 中的 img 标签内的 md-tooltip

    我想在悬停在 3 个不同图像上时显示 3 个不同的工具提示
  • jQuery:评估 ajax 响应中的脚本

    来自我的 web 应用程序的 XML 响应既有要添加到页面的 HTML 也有要运行的脚本 我正在尝试从我的网络应用程序发回 XML 例如
  • 如何调试@font-face问题?

    我有以下 CSS 代码 theMixPlainSemiBold font face font family theMixPlainSemiBold src url css fonts eot src url css fonts eot ie
  • svg 圆不是用 javascript 绘制的

    我一直在尝试使用 HTML 中的 javascript 来进行 svg 操作的 hello world 我编写了下面的代码 虽然它生成了正确的 html 但我在浏览器中没有看到任何输出 也没有看到任何错误
  • 为什么 Jqgrid 冻结列似乎不能与过滤器行和过滤器标题一起使用?

    我无法让冻结列与 jqgrid 4 3 0 一起使用 我唯一能想到的是我有一些不是开箱即用的具体东西 我在顶部使用过滤行 我使用 cloneToTop true 显示网格顶部的所有按钮 我有以下代码 用于在 jqggrid 顶部显示过滤器状
  • 常见的电子邮件客户端是否会预取链接而不是图像?

    尽管我知道很多电子邮件客户端会预取或以其他方式缓存图像 我不知道有任何预取常规链接 例如 a href somelinkhere some link a 这是某些电子邮件的做法吗 如果是 是否存在某种不跟随类型rel可以添加到链接中以帮助防
  • 不透明div内的透明文本

    我有一个背景图像 上面有一个白色的 div 我希望该 div 内的文本是透明的 以便您可以 透过 背景图像 这有可能吗 应该看起来像这样 您需要将其用于您的文本CSS webkit text fill color transparent
  • Nodejs Base64 中的读取文件

    我正在尝试从客户端读取以 base64 编码的图像 如何使用nodejs进行阅读 My code add to buffer base64 image var encondedImage new Buffer image name base
  • 如何让背景覆盖一个单独的div?

    我正在做一个带有侧菜单的网站 屏幕的 30 是菜单 其余是内容 div的内容 我用COVER的方法放了一张背景图 我用了第一个例子 https css tricks com examples FullPageBackgroundImage
  • Firefox 扩展中的 localStorage

    我正在尝试从 Firefox 扩展访问页面的 localStorage 我的理解是content给出了参考window当前页面的 当我尝试访问页面的 localStorage 时content localStorage 我想我正在得到它的参
  • jQuery UI 和原型冲突

    我正在 Perl 中向我们的网站添加一个新表单 不是我的选择 表单会自动生成大量 html 以创建一致的外观 我的问题在于遗留系统在整个页面 包括加载时 中使用原型来处理各种事情 不过我想使用 jQuery 主要是 jQuery UI 中的
  • regex php - 查找 div 中具有特定 ID 的内容

    我确信这是一个简单的问题 尽管我在谷歌上进行了如此多的搜索和搜索 但我似乎无法弄清楚这有什么问题 我在此页面上的其他区域使用类似的表达式来准确返回我想要的内容 但是 我无法让这个特定的位返回我想要的东西 所以也许有人可以帮助我 我有一个带有
  • 过早退出 Qualtrics 中的循环和合并块

    我目前正在进行一项 Qualtrics 调查 受访者必须解决一长串字谜问题 然后回答一些人口统计问题 为了使变位词部分更容易 我使用了循环和合并块 第一个字段是要解决的变位词 第二个字段是变位词的解决方案 因此调查可以根据受访者的答案来检查
  • 如何使用复杂对象或json在ng-table中添加动态列?

    我有以下 ng table 代码 参见笨蛋 http plnkr co edit oTxkmtAwt22gtO2JDPg4 p preview var app angular module main ngTable controller D
  • 如何创建包含左对齐元素的宽度不确定的居中 div?

    我有几个统一的蓝色元素 div style display inline block 位于紫色 div 内的红色 div 内 Mockup https i stack imgur com ylTm9 png 图 我希望蓝色元素左对齐 一行中
  • jquery 验证数组输入的添加规则[重复]

    这个问题在这里已经有答案了 我想将复选框值存储在数组中 但是 我无法使用验证规则 因为名称是selectList 代替selectList 我尝试了 id 但似乎规则只绑定到名称 html

随机推荐

  • 在 CodeIgniter 会话中存储具有相同名称的多个输入

    我已经发布了这个在 CodeIgniter 论坛中 http codeigniter com forums viewthread 155508 并且也耗尽了论坛搜索引擎 所以如果交叉发帖不被允许 我们深表歉意 本质上 我有一个输入 设置为
  • 如何将基于 Qt4.6 Phonon 的媒体应用程序移植到 Qt 5.1?

    我有一个基于 Qt 4 6 的应用程序 它使用 QtWebView 加载带有标签的 HTML 页面 以便在 Windows 平台上播放网络多媒体源 我没有使用默认的 PHONON 播放引擎 而是构建了另一个 PHONON 后端引擎来处理媒体
  • 帮助手册中的锚点不起作用

    我已经仔细检查了所有内容 希望有人能发现我没有看到的愚蠢错误 我正在尝试为我的应用程序构建一个 Apple 帮助部分 它可以正确地转到登录页面 但是没有一个锚点起作用 登陆页面称为index html另一个页面称为test html它位于p
  • 如果相机平移也在 Z 方向,单应性在平面场景的两个图像之间是否成立?

    我正在尝试计算两个图像之间的相对姿势 并且我正在使用单应性来过滤特征匹配 我有一个相当平面的场景 只要两个图像之间的平移仅限于 X 和 Y 轴 opencv 约定 基于单应性的相对姿态估计就可以非常准确地工作 一旦我开始使用另一个相机沿 Z
  • .NET Core:Process.Start() 留下 子进程

    我正在构建一个部署在 CentOS 7 2 上的 ASP Net Core netcore 1 1 应用程序 我有一个通过 System Diagnostics Process 调用外部进程 也是使用 net core 构建的控制台应用程序
  • iOS/MacOS 框架中是否有为 CFBundleShortVersionString 定义的常量

    我知道 CFBundleVersion plist 键有一个常量 定义为kCFBundleVersionKey在 CoreFoundation 的 CFBundle h 标头中 但是 CFBundleShortVersionString 有
  • 可以用Java开发iPhone应用程序吗?

    无意间看到这样的广告 http monotouch net DownloadTrial ref so1 http monotouch net DownloadTrial ref so1 然后我开始怀疑 Java 中是否有类似的东西 据我了解
  • 是否可以通过 URL 调用 Web API 来获取实时数据?

    假设您有一个 ASP NET MVC 4 Web API 项目 当您通过 URL 调用其中一个资源时 它会等待获取指定时间段的性能监控数据 然后在完成后以 JSON 形式返回所有数据 但是 在输入 URL 和过程完成之间 是否有一种方法可以
  • 我们是否需要更喜欢构造函数而不是静态工厂方法?如果是的话,什么时候?

    我一直在阅读有效的Java by 约书亚 布洛赫到目前为止 它确实名副其实 第一项就提供了令人信服的理由静态工厂方法 over 构造函数 以至于我开始质疑那些好的旧构造函数的有效性 本书的优点 缺点总结如下 优点 他们有名字 我们拥有全面的
  • Predict() - 也许我不理解它

    I 今天早些时候发布 https stackoverflow com questions 9026383 error in predict关于我使用时遇到的错误predict功能 我能够纠正这个问题 并认为我走在正确的道路上 我有许多观察结
  • TFS2012错误的用户丢失工作区

    我的 TFS2012 有一个非常不寻常的问题 我们刚刚跨域迁移并从 TFS2010 升级到 TFS2012 一切似乎都与一个用户无关 我们似乎无法让他的工作空间正常工作 当我连接到 TFS 服务器时 我输入服务器名称和端口号 这会连接 但在
  • 如何向 CellList 添加或删除单个元素?

    如何添加 删除单个元素CellList http google web toolkit googlecode com svn javadoc 2 1 com google gwt user cellview client CellList
  • 在github上打开时如何更改Visual Studio的版本

    我有VS2015和VS2017 当我在 GitHub 上选择 在 Visual Studio 中打开 时 我想将其更改为使用 VS2017 而不是 VS2015 我怎样才能做到这一点 通过另一个问题找到了答案 使用 github 时 找不到
  • 在 Neo4j 中可视化连接的组件

    我可以使用下面的代码找到图中最密集连接的组件 CALL algo unionFind stream pnHours YIELD nodeId setId groupBy setId storing all node ids of the s
  • 如何同时(并行)调用远程计算机上的相同功能

    我正在编写一个脚本 该脚本具有多个需要时间在不同远程计算机上执行的函数 有什么方法可以以并行方式同时调用命令它们吗 举个例子将不胜感激 谢谢 Invoke Command已经对每台计算机并行执行调用 作为内置功能的一部分 https tec
  • 如何从 AngularJS 中的自定义指令 * 具有自己的作用域 * 访问父作用域?

    我正在寻找访问指令中 父 范围的任何方式 范围 嵌入 要求 从上面传入变量 或范围本身 等的任何组合 我完全愿意竭尽全力 但我想避免一些完全hacky或无法维护的东西 例如 我知道我现在可以通过采取 scope从 preLink 参数并迭代
  • 如何通过guard angular2隐藏链接

    如何在视图 html 中隐藏管理链接 我必须守护 管理员和经理 路由器配置 path manager component ManagerComponent canActivate ManagerGuard path user compone
  • Jenkins 在解析 pom 时失败

    我的 Jenkins 服务器上的一项作业出现问题 在 pom 解析期间失败并显示以下消息 Parsing POMs Modules changed recalculating dependency graph workspace java
  • 水平计数加工织物中的白色簇

    我对织物材质进行了处理 得到如下图所示的图像 原图 处理后的图像 现在 我想找到连续的白色簇的数量 如果所有簇都是均匀且完全水平的 我将运行一个循环来计算强度的上升和下降 以找到簇的数量 但事实并非如此 如果我通过上述方法取几行的中值 平均
  • 如何合并 jQuery 数据表 excelHtml5 中列的匹配值

    当我从数据表导出 Excel 时 我无法合并 col 值 由于列的值B named Category 需要合并重复值 我是编程新手 感谢任何帮助 这是我的我的jsfiddle https jsfiddle net t1j6rzg8 2 这是