开发者

JQuery UI resizable can't cancel resize programmatically

开发者 https://www.devze.com 2023-02-13 21:20 出处:网络
I have been trying to create a resizable div using JQuery UI which will also resize a table contained within the div.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消