Monday, 15 July 2013

Durandal 2.0 Dialog Repositioning -



Durandal 2.0 Dialog Repositioning -

at bottom of durandal docs dialogs / modals (http://durandaljs.com/documentation/showing-message-boxes-and-modals.html) there's syntax repositioning dialog. dialog have gets gradually bigger user selects stuff, every time selection made, i'd phone call reposition(). tried next along this:

vm.compositioncomplete = function (child, parent, context) { var addeditdialog = dialog.getdialog(context.model); // resolves // whenever selected: addeditdialog.context.reposition(vm); // no method 'reposition' }

but error - there no function reposition. doing wrong?

you can set custom dialog context responds reposition message (using durandal's app.trigger()). trigger message upon event in dialog (such as, say, user's selecting stuff).

also in custom dialog context, create method phone call reposition. in activate or attached handler of custom dialog context, subscribe message utilize trigger reposition.

i'm advocating messaging approach because may wish isolate "selection viewmodel" in own viewmodel, , compose custom dialog context. approach, selection viewmodel , custom dialog context loosely bound. way, utilize selection viewmodel elsewhere in code (and have other viewmodel, instead of custom dialog context, respond reposition message).

durandal durandal-2.0

No comments:

Post a Comment