Double click Jqgrid does not work in Cellular

Asked

Viewed 103 times

0

I have a Jqgrid that works perfectly in the browsers of the computer, however when I open on mobile, the double click function stops working.

  $table.jqGrid({
            url: '/Representantes/ConsultaEntrega/lista',
            datatype: 'json',
            mtype: 'GET',
            postData: {
                representante: function () { return jQuery("#representante option:selected").val(); },
                documento: function () { return jQuery("#documento").val(); },
                pedido: function () { return jQuery("#pedido").val(); },
                cnpj: function () { return jQuery("#cnpj").val(); },
                razao: function () { return jQuery("#razao").val(); },
                transportadora: function () { return jQuery("#transportadora").val(); },
                redesp: function () { return jQuery("#redesp").val(); },
                mostrar: function () { return jQuery("#mostrar option:selected").val(); }
            },

            colModel: [
                { label: 'PEDIDO', name: 'D2_PEDIDO', width: 60 },
                { label: 'DOC', name: 'F2_DOC', width: 80 },
                { label: 'SÉRIE', name: 'F2_SERIE', width: 40, hidden: true },
                { label: 'CLIENTE', name: 'F2_CLIENTE', width: 60 },
                { label: 'LOJA', name: 'F2_LOJA', width: 50 },
                { label: 'RAZÃO', name: 'F2_ZRAZAO', width: 250 },
                { label: 'CHAVE', name: 'F2_CHVNFE', width: 320, hidden: true },
                { label: 'COD.TRANS', name: 'CODTRA', width: 85 },
                { label: 'TRANSPORTADORA', name: 'NOMETRA', width: 120 },
                { label: 'REDESPACHO', name: 'NOMERED', width: 80 },
                { label: 'EMISSAO', name: 'F2_EMISSAO', width: 80 },
                { label: 'SAÍDA', name: 'F2_ZDTSAID', width: 80 },
                { label: 'PREV.ENTREGA', name: 'GWU_DTPENT', width: 95 },
                { label: 'ENTREGA', name: 'GWU_DTENT', width: 80 },

            ],

            viewrecords: true,
            rowNum: 20,
            rowList: [20, 40, 100],
            shrinkToFit: false,
            width: 1000,
            height: 350,
            emptyrecords: "Nenhum Registro",
            loadtext: "Buscando e carregando...",
            pager: "#jqGridPager",
            loadonce: true

        });


        $table.dblclick(function () {
            var kwGrid = $("#jqGrid").jqGrid('getGridParam', 'selrow');
            if (kwGrid != null) {
                var ret = $("#jqGrid").jqGrid('getRowData', kwGrid);
                chave = ret["F2_CHVNFE"];
                var documento = ret["F2_DOC"];

                MostraDetalhes(documento, chave);
                DownloadPdf(chave);
            }
        });

1 answer

1


Daniella already used the customization of the double click function below and works perfectly in both mobile and desktop.

var touchtime = 0;
$(".target").on("click", function() {
    if (touchtime == 0) {
        // set first click
        touchtime = new Date().getTime();
    } else {
        // compare first click to this click and see if they occurred within double click threshold
        if (((new Date().getTime()) - touchtime) < 800) {
            // double click occurred
            alert("double clicked");
            touchtime = 0;
        } else {
            // not a double click so set as a new first click
            touchtime = new Date().getTime();
        }
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<div class="target">Double click me</div>

Or Jsfiddle Demo

Thanks to Justcarty.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.