MikeMitterer / dart-material-design-lite

Material Design Lite Components, Directives + SPA with HTML, CSS + Dart
http://www.material-design-lite.pub/
Other
228 stars 26 forks source link

InputField in Custom dialogs do not work #20

Closed vadimtsushko closed 9 years ago

vadimtsushko commented 9 years ago

Hi, Mike.

I want to add custom dialog with several TextField contols to my MDL application. Basically it is an edit form invoked to edit row in data-table. But when I'm adding textfields to CustomDialog template they show up as intended but not respond to any keyboard or mouse input. I've made a gist demonstrating my problem: TextField works perfectly in main page and does not work in the dialog. Could you give me any directions - how I can to solve this?

https://gist.github.com/vadimtsushko/2a865ca2d3af5764fcf1

vadimtsushko commented 9 years ago

Reading source code I've found that it works if I add acceptEscToClose: false parameter in DialogConfig, like this:

CustomDialog({this.title: "", this.yesButton: 'Yes', this.noButton: 'No'})
  : super(new DialogConfig(acceptEscToClose: false));

So all good for me. Though maybe it should be mentioned somewhere in documentation. But having much less documented projects myself I would not dare lecture anybody, and especially you about documentation :) Thank you for project, I'm apparently jumping in it.

MikeMitterer commented 9 years ago

Thanks for your response! I'll check your gist next week - have a nice weekend.

MikeMitterer commented 9 years ago

Thanks for your issue report! CustomDialog II is more or less your sample! I've also adde a little feature - autofocus (first input has this attribute...) 1.5.2 is available for you :-)

In your Gist you did not use @MdlComponentModel for your CustomDialog. If you don't use this annotation the dart2js version of your app won't work. This annotation avoids JS minification so that MDL/Dart (Mustache-Template) can find the Dialog and only if it finds it it can be used as data-model. The Dialog is a data-model because the event-compiler (e.g. data-mdl-click="onSubmit()") uses this object to search for public functions and public properties.

screenshot-1837

vadimtsushko commented 9 years ago

Thank you