Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to prevent auto-resizing a dijit.dialog containing a dijit form?

Tags:

dialog

dojo

I have a dijit.dialog containing a templated form. When the dialog is visible and I resize the window, the form height decreases(even if I increase/decrease window size). What is causing this weird behavior and how to prevent it? Thanks.

code: @LoginForm.html--

<form  data-dojo-attach-point="containerNode"
    data-dojo-attach-event="onreset:_onReset, onsubmit:_onSubmit">
    ..
    ..
</form>

@LoginForm.js--

dojo.declare("LoginForm", [dijit.form.Form], {

  widgetsInTemplate: true,
  templateString: dojo.cache('template/LoginForm.html'),

  name: 'Login',
  'class': 'loginForm',
  'context': {'message':'hello'},

  action: '/authenticate',
  method: 'POST',
  onSubmit: function(event) {
  // something here
  },
  postCreate: function(){
  //
  },
  startup: function(){
   this.inherited(arguments);
  }
});

@index.html(this is shown on browser which calls LoginForm.js, creates an instance of the widget, places it at dojo.body() and shows it )--

like image 656
0xc0de Avatar asked Dec 21 '25 14:12

0xc0de


1 Answers

I did a bit of research of few hours on this, and found a trace.

When the window is resized, it tries to call Form.resize() expecting that the form will call resize on its children. But since Form isn't a layout widget nothing happens. I overrode the resize() of the form( to do nothing!) the bug seems to be vanished.

I am still not sure if I have the complete solution( after all overriding is not a way of fixing something). If anyone has a better explanation/solution please enlighten me. Thanks.

like image 89
0xc0de Avatar answered Dec 24 '25 11:12

0xc0de



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!