Hi everyone,
I've got a tricky problem.
I've made a jquery Widget plugin :
$.fn.Widget=function(id_place,id_event,options){};
I call it once when the page is ready : (specifying that I want a last sorting)
$(document).ready(function() {
$('#mydiv').Widget(13,50,{"sort":"last"});
});
But in this plugin, I generate a little menu bar, with 3 links to change the sorting of my elements : "last" (initial call); "top" (most popular) and "answered" (with answers)
My question is : how to, in this generated code inside my plugin, Sort PopularSort LastSort answered, change the sorting of my Widget??
Can I call Widget(13,50,{"sort":"top"})
inside of it, Or can I use a inside function like change_sorting(top)
??
Thx a lot for your time and your help
EDIT: Thanks for your answers: I've added these lines in my plugin:
var object = $(this);
$(".sort_last").click(function(){ object.Widget(13,50,{"sort":"last"}); });
$(".sort_top").click(function(){ object.Widget(13,50,{"sort":"top"}); });
$(".sort_answered").click(function(){ object.Widget(13,50,{"sort":ansered"}); });