javascript - jquery pop up having to press twice"OK" twice in order to make it disappear -
i have problem trying find out why have press "ok" button of pop button twice in order make disappear. can see code have 1 alert statement , still behaves if may have accidently called 2 alert statements
function intialisekendogrid(date) { gridresult = $('#grid').kendogrid({ scrollable: { virtual: true }, navigatable: true, groupable: true, sortable: true, selectable: "row", pageable: true, pageable: { input: true, numeric: false }, resizable: true, reorderable: true, filterable: { extra: false }, columns: [{ field: "dealnumber", width: 150, title: "dealnumber", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } }, }, { field: "dealissuer", width: 150, title: "issuer", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } }, //template: "<a href='http://manager.dealogic.com/managerv3/cpcortex/default/${dealnumber}'>${dealnumber}</a>" template: "<a>${dealissuer}</a>" }, { field: "ticker", width: 150, title: "ticker", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } } }, { field: "dealexchange", width: 150, title: "exchange", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } } }, { field: "dealtype", width: 150, title: "type", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } } }, { field: "dealvalue", width: 150, title: "value ($m)", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } }, /* template: '#= kendo.culture("en-us");kendo.tostring(${dealvalue/1000000},"p")#' */ template: '#= kendo.tostring(dealvalue,"c2") #' }, { field: "dealstatus", width: 150, title: "status", filterable: { operators: { string: { startswith: "starts with", contains: "contains" } } } }, { field: "dealpricingcompletiondate", width: 230, title: "dealpricingcompletiondate", format: "{0:dd/mm/yyyy}", filterable: { ui: "datetimepicker", operators: { date: { gt: "after", lt: "before", eq: "equals" }, messages: { filter: "apply", clear: "clear" } } } }, ], change: function () { var text = ""; var grid = this; grid.select().each(function () { var dataitem = grid.dataitem($(this)); text += "dealnumber: " + dataitem.dealnumber + "\n" + "issuer: " + dataitem.dealissuer + "\n" + "ticker: " + dataitem.ticker + "\n" + "type: " + dataitem.dealtype + "\n" + "value: " + dataitem.dealvalue + "\n" + "status " + dataitem.dealstatus + "\n" + "dealpricingcompletiondate: " + kendo.tostring(dataitem.dealpricingcompletiondate, "dd/mm/yyyy"); }); alert(text); }, height: 700 }).data("kendogrid");
the change event being triggered twice, , since alert()
being bound change event, pop twice.
take @ change event documentation. "fired when user selects table row or cell in grid."
perhaps being fired twice, 1 row , 1 cell? although see have selectable: "row"
should fire row.
update change event change: function (e) { console.log(e); }
, see outputs in debug console. give hint element being triggered on.
you can try adding e.preventdefault();
change event stop other event being triggered.
Comments
Post a Comment