Events not firing
See original GitHub issueI have registered the events click, selected e deselected but the events selected e deselected does not fires. The grid is inside a modal.
below is the code of my initialization.
$(document).ready(function () {
$("#grid-consultaendereco").bootgrid({
ajax: true,
url: "/Public/ConsultarEndereco",
selection: true,
multiSelect: false,
rowSelect: true,
searchSettings: {
delay: 100,
characters: 3
},
labels: {
all: "Todos os registros",
loading: "Aguarde carregando...",
refresh: "Atualizar",
search: "Procurar",
noResults: "Sem registros",
infos: "Exibindo {{ctx.start}} até {{ctx.end}} de {{ctx.total}} registros"
}
}).on("selected.rs.jquery.bootgrid", function (e, rows) {
console.log(row);
alert("selected");
}).on("deselected.rs.jquery.bootgrid", function (e, rows) {
alert("deselected");
}).on("click.rs.jquery.bootgrid", function (e,columns,rows) {
alert("click");
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:5
Top Results From Across the Web
Event listeners not working? 3 key areas to troubleshoot
Are your event listeners not working as you'd expect? Here are 3 key areas to troubleshoot to help you get everything triggering as...
Read more >jQuery event not firing - javascript - Stack Overflow
If you happen to use .remove() to extract something temporarily from the DOM and then reinsert it, then you will lose your events....
Read more >Events not firing (or being handled) - Laracasts
I noticed you said "handler" when referring to what normally is called a "listener." A listener must be registered to an event before...
Read more >Events not firing - Scripting Support - DevForum | Roblox
Now I'm not 100% that CharacterAdded doesn't fire in local scripts but I don't think thats the problem since CharacterAppearanceLoaded fires.
Read more >Bind Events To Not firing - Unreal Engine Forums
You have bound to the event, but you haven't fired the event. You need to call 'test event'. I think you're going to...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Try to add data-type=“numeric” on your data-identifier.
method: Grid.prototype.select
looking the code, on the line ~1570:
if (this.currentRows[i][this.identifier] === id)
note to
===
, that returns false if row data is'1' (string)
and id is1 (numeric)
if your prefer you can modify this line replacing===
to==
then the condition will return true.looking below you can see inside other ‘if’ the code: (line ~1605)
this.element.trigger("selected" + namespace, [selectedRows]); //self explainable
I ran into this problem too, but for some reason adding data-type=“numeric” and data-converter=“numeric” did not work. I found that the IDs in my data were strings (I’m using MySQL, PDO and json_encode in PHP on my backend). I ended up having to loop through my dataset before calling json_encode, casting the IDs to integers. Now my events fire fine.