changePage () loads and returns to the previous page
Greetings.
I am developing an application for the loading of articles for an invoice, and I have been using changePage () without problems usually a series of inputs are initialized and selects with javascript / JQuery. but when you search for an article and load a datatable it shows me the resulting page with the datatable loaded and returns me. Next I show the used code.
Custom toolbar element within the datatable:
- <div data-role="controlgroup" data-type="horizontal" data-mini="true">
- <button type="button" id="btn-buscar"><i class="fas fa-search"></i></button>
- <input id="wkarticulo_buscar" name="wkarticulo_buscar" type="text" data-wrapper-class="controlgroup-textinput ui-btn" placeholder="Articulo" />
- <a id="AbreQR" href="#LeerCodigoQR" data-rel="popup" data-position-to="window" data-transition="slidedown" class="ui-btn ui-corner-all">
- <i class="fas fa-qrcode"></i>
- </a>
- </div>
JavaScript / JQuery:
- $("#btn-buscar").on("click", function () {
- var buscar = $("#wkarticulo_buscar").val();
- if (buscar) {
- BuscaArticulo(buscar); // Load datatable
- $.mobile.changePage("./#ListaArticulos", {
- transition: "slidedown",
- changeHash: true
- });
- };
- });
- $("#wkarticulo_buscar").keypress(function (e) {
- if (e.which == 13) {
- var buscar = $("#wkarticulo_buscar").val();
- if (buscar) {
- BuscaArticulo(buscar); // Load datatable
- $.mobile.changePage("./#ListaArticulos", {
- transition: "slidedown",
- changeHash: true
- });
- };
- };
- });
- $(document).on("pageshow", "#ListaArticulos", function () {
- clearInterval(AutoRefresh);
- DataTable.ajax.reload();
- DataTable
- .columns.adjust()
- .responsive.recalc()
- .draw();
- });
After loading the page, it returns me to the previous one.
I hope you have explained me well.