CoffeeInit
Masanobu Shimura edited this page Jul 9, 2015
·
2 revisions
#customer.coffeeの初期化処理の概要# #PAGE Store関連定義# 行52-67
$w.constants =
$W_LOGIN_SUCCESS: "$W_LOGIN_SUCCESS"
$w.actions = {
}
$w.PageStore = Fluxxor.createStore(
initialize: ->
@data =
{
}
#@bindActions $w.constants.$W_LOGIN_SUCCESS, @onLoginSuccess,
return
)
この場合は、基本的に何も定義していないので、内容はDummyです。
必要により、$w.constants, $w.action, bindActionを定義します。
##FluxxorおよびStoreの定義##
行69-82
$w.flux = new Fluxxor.Flux()
$w.pageStore=new $w.PageStore;
$w.flux.addStore("PAGE",$w.pageStore)
$w.flux.addActions($w.actions)
$w.commonStore=new $c.CommonStore;
$w.flux.addStore("COMMON",$w.commonStore)
$w.flux.addActions($c.actions)
$w.rcdStore=new $c.RcdStore;
$w.flux.addStore("RCD",$w.rcdStore)
$w.flux.addActions($c.rcdActions)
rcdStore = $w.flux.store("RCD")
rcdStore.addTable("customer")
$w.FluxMixin = Fluxxor.FluxMixin(React)
$w.StoreWatchMixin = Fluxxor.StoreWatchMixin
rcdStore.addTable("customer")
でRCD Storeに customer テーブルを設定。
RCD Storeは複数のテーブルを分離して扱う事が出来ます。
##一覧テーブルのHeader部分とBody部分の左右スクロール同期の為の設定## 行93-99
$w.getDom = (refname) ->
return $w.app.refs[refname].getDOMNode()
$w.customer_scroll = ->
$w.getDom("customer_tableHead").scrollLeft=$w.getDom("customer_tableBody").scrollLeft
$w.customer_onscroll = ->
$w.getDom("customer_tableBody").onscroll=$w.customer_scroll