I have been trying to create a resizable div using JQuery UI which will also resize a table contained within the div.
$("#WorkRequests").resizable({
minWidth: $("#WorkRequests").width(),
maxWidth: $("#WorkRequests").width(),
handles: 's',
resize: function (event, ui) {
var minRows = 10;
var rowHeight = 35;
var rows = $("#tbl-WorkRequests-page-size").val();
if ((rows * rowHeight) > $("#WorkRequests").height()) {
if (rows > minRows) {
$("tbl-WorkRequests-page-size").val((rows - minRows).toString());
} else {
开发者_如何学Python return false;
}
}
}
});
However when they resize the div to be too small so that it reaches "return false;" it does not cancel the resize event like with other JQuery ui things. Why?
Also the below line:
$("tbl-WorkRequests-page-size").val((rows - minRows).toString());
Should set the value of a select list, however it does not, why?
The short answer is: This is not possible because draggable is not correctly implemented. return false should stop the event, but unfortunately this is not correctly implemented for resizable.
Turns out on this line
$("tbl-WorkRequests-page-size").val((rows - minRows).toString());
I was missing the #, sorry guys, I should have posted the html.
$("#tbl-WorkRequests-page-size").val((rows - minRows).toString());
Thanks, Alex.
精彩评论