JQuery dialog resize event

I have a dialog that hosts a third-party plugin (jqGrid). I want jqGrid automatically resize when the dialog box is resized. I also want this dialog to be width: 'auto' , because there is other content that can grow.

When resizing a dialog box due to content, I do not fire the dialogresize event. Here is an example: manually resizing a dialog box raises the dialogresize event, but clicking the button does not raise dialogresize , even if the dialog has resized:

http://jsfiddle.net/LfpC7/

Do you know if it is possible to catch an event when the dialog changes as a result of width: 'auto' ?

thanks

+4
source share
1 answer

You can use the jQuery UI resize event dialog.

This event is fired when the dialog box is resized. Demo Code Samples

Set a callback function to handle the resize event as an init parameter.

  $( ".selector" ).dialog({ resize: function(event, ui) { ... } }); 

Bind to the resize event by type: dialogresize.

  $( ".selector" ).bind( "dialogresize", function(event, ui) { ... }); 
+6
source

Source: https://habr.com/ru/post/1435051/


All Articles