bootstrap-tables onRefresh事件不起作用

时间:2017-06-18 20:47:42

标签: bootstrap-table

知道为什么onRefresh事件没有被触发?第一次通过表格正确显示。但是当单击刷新按钮时它不起作用(事件不会触发)。我之前认为这有用,但我认为bootstrap.min.js的新版本可能已经杀了它(或许这只是巧合)。任何帮助都会有所帮助。

HTML:

#include <string>
#include <iostream>
#include <map>
#include <utility>
#include <vector>

int main()
{
    std::vector< std::string >value;
    std::map< std::pair<std::string , std::string> ,    std::vector<std::string> > myMap;
    std::string input1,input2,MyvectorValue;
    for(int i=0;i<5;++i)
    {

        std::cin>>input1;
        std::cin>>input2;
        std::cin>>MyvectorValue;
        myMap[std::make_pair(input1,input2)].push_back(MyvectorValue);
    }

    //If you have a particular key (string1, string2), and want to print the values for that specific key...
    auto particularKey = std::make_pair("stringA", "stringB");
    for(auto val : myMap[particularKey])
        std::cout << val << " ";
    std::cout << std::endl;

    // If you want to iterate through all keys of your map
    for(auto &elem : myMap)
    {
        std::cout << "for the pair with key (" << elem.first.first << "," << elem.first.second << "), the value is the following vector" << std::endl;
        for(auto s : elem.second)
        {
            std::cout << s << " ";
        }
        std::cout << std::endl << std::endl;
    }
    return 0;
}

Javascript(按钮可以使用此功能):

<table id="stats-view-output4" data-pagination="false" data-show-refresh="true" data-search="false" 
               data-cache="false" data-show-toggle="false" data-show-columns="false"
               data-show-header="false" data-show-footer="false">
</table>

1 个答案:

答案 0 :(得分:0)

好吧,我放弃并做了一个强力解决方案。在某处感觉像是一场冲突的错误。对于任何绊到这里的人来说,这是:

HTML:

        <div id="toolbar4">
            <div class="form-inline" role="form">
                <button id="refresh4" class="btn btn-default" type="submit"><span class="glyphicon glyphicon-refresh"></span></button>
            </div>
        </div>
        <table id="stats-view-output4" data-pagination="false" data-show-refresh="false" data-search="false" 
               data-cache="false" data-show-toggle="false" data-show-columns="false"
               data-toolbar="#toolbar4" data-toolbar-align="right"
               data-show-header="true" data-show-footer="false" style="font-size:11px;">
        </table>

Javascript:

$(function () {
    $('#refresh4').click(function () { 
        bpt_pie_chart();
    });
});

function do_trader_instruments() {
  $('#stats-view-output4').bootstrapTable({

    columns: [{
       field: 'TradedInstruments',
       title: 'Traded Instruments'
    }],
      data: [{
      TradedInstruments: "<div id='instrument-chart'></div>"
    }]
  });
  bpt_pie_chart();
}