Ich verwende Bootstrap-Tabelle, um Daten von meinem MongoDB anzuzeigen, mit einer Mongoid-Abfrage. Ich möchte den Tisch im Abstand von 5 Minuten auffrischen. Ich habe die Dokumentation gelesen, aber ich bin neu in Javascript, ich bin nicht sicher, wie dies zu erreichen ist - ob ein Ajax Anruf oder nur eine setTimeout() Funktion, etc.Bootstrap-Tabelle aktualisieren
Dies ist meine Tabelle code:
<table id="table" data-show-refresh="true" data-row-style="rowStyle" data-toggle="table" data-url="http://maccdx160121:4567/api/v1/currentsat*">
<thead>
<tr>
<th data-field="initials">Initials</th>
<th data-cell-style="cellStyle" data-field="sector">Sector</th>
<th data-field="cjs">CJS</th>
</tr>
</thead>
</table>
Das ist meine Mongoid Abfrage, wenn es hilft:
get '/currentsat*' do
#SatTransaction.where(current: true, :initials.ne => nil, :position.in => ["RDR", "SPVR", "OJI"]).to_json
SatTransaction.where(current: true, :shift_duration.ne => 0,).and(SatTransaction.or({:position.in => ["SPVR", "RDR", "OJI"]},{sector: "BREAK"}).selector).to_json
end
end
before do
cache_control :no_cache
end
def with_captured_stdout
old_stdout = $stdout
$stdout = StringIO.new('', 'w')
yield
$stdout.string
ensure
$stdout = old_stdout
end
Danke für jede Hilfe !!
Ich glaube, ich sehe, was Sie tun, aber ich bin nicht sicher, wie es in meinen Code zu integrieren . Ich konnte das folgende Javascript zusammensetzen, das für das, was ich brauche, funktioniert, wenn auch nicht so professionell wie ein Ajax-Anruf. – user2843365