问题
i am working on drag and drop tables like in this example: http://www.primefaces.org/showcase/ui/dndTable.jsf
and i was wondering if it's possible to invoke JS code to hide/show components when start dragging an item.
please advise, thanks.
回答1:
PrimeFaces using jQuery draggable interaction you need to check this out. Kickoff example:
$(function() {
$( ".ui-dt-c" ).draggable({
start: function() {
alert(1);
},
drag: function() {
alert(2);
},
stop: function() {
alert(3);
}
});
});
As you can see this is firing recurring alert events because of the drag
func. you can change it as you wish. Also you can try to change class to .ui-dt-c ui-draggable
. Like in the jQuery example, you can to select the element by it's ID and override the function however, p:dataTable
id's are messed up so selecting element by it's class
makes more sense to me.
来源:https://stackoverflow.com/questions/16262698/how-to-invoke-javascript-when-dragging-starts