当前位置: 代码迷 >> Web前端 >> 3查的View & Controller binding
  详细解决方案

3查的View & Controller binding

热度:646   发布时间:2013-03-16 11:51:46.0
三查的View & Controller binding

带着ROR的思想看三查,几乎被看到了沟里,几个弯始终拐不过来。比如,sancha似乎并不像ROR那样默认通过名字来绑定V和C,具体是怎么做的,我纠结了好久。今天写程序的时候终于开了窍,总结规则如下:

?

? ? // The name of controller and view does not necessary to have any relationship,?

? ? // Essentially the controller does not bind to any "view", rather than bind to

? ? // certain UI element defined in refs, by using componentSelector

? ? //

? ? // So the MVC behavor of sencha is not exactly same as in ROR, which the name

? ? // of controller and view has kind of mapping by default

? ? //

? ? // And the most important thing here, is that:

? ? // WE ACTUALLY COULD BIND A DOM EVENT OF SINGLE VIEW TO MULTIPLE CONTROLLERS,

? ? // BY DEFINE THE SAME SELECTOR!

? ? // VICE VERSA, A SINGLE CONTROLLER COULD DEFINE SET OF HANDLERS FOR DOM EVENT

? ? // SITS IN MULTIPLE VIEWS!

  相关解决方案