How to change passed parameter in custom event
I have a custom event, which rising when new Item created:
Event definition
$.fn.extend({
OnListItemCreated: function (callback) { $(this).bind('OnListItemCreated', c开发者_如何学Pythonallback); }
});
When item created, call this:
dialogListFiled.trigger("OnListItemCreated", newItem);
.... need to using UPDATED newItem....
Event handling:
myObject.OnListItemCreated(function (newItem) {
newItem.CountryId=...
...update some newItem values....
});
How best way to handle newItem and update it?
Actually i had same problem of yours, i needed to handle new elements creation, i used Jquery.liveQuery Plugin, original live() method cannot monitor creation of elements
Sample: (You can do this simply by adding a class to your elements which you want to monitor)
$("[class='mylist']").livequery(function(){
this.CountryId = 1; // handle your element
});
精彩评论