Only send changes back to client
This commit is contained in:
@@ -24,10 +24,10 @@ feature
|
||||
local
|
||||
panel: WSF_MULTI_CONTROL
|
||||
do
|
||||
create textbox1.make ("txtBox1", "1")
|
||||
create textbox2.make ("txtBox2", "2")
|
||||
create button1.make ("sample_button1", "SUM")
|
||||
create textbox_result.make ("txtBox3", "")
|
||||
create textbox1.make_text ("txtBox1", "1")
|
||||
create textbox2.make_text ("txtBox2", "2")
|
||||
create button1.make_button ("sample_button1", "SUM")
|
||||
create textbox_result.make_text ("txtBox3", "")
|
||||
button1.set_click_event (agent handle_click)
|
||||
create panel.make ("panel")
|
||||
panel.add_control (textbox1)
|
||||
|
||||
@@ -7,7 +7,6 @@ trigger_callback = (control_name,event)->
|
||||
cache: no
|
||||
.done (new_states)->
|
||||
#Update all classes
|
||||
window.states = new_states
|
||||
for name,state of new_states
|
||||
controls[name]?.update(state)
|
||||
return
|
||||
@@ -35,7 +34,9 @@ class WSF_BUTTON_CONTROL extends WSF_CONTROL
|
||||
trigger_callback(@control_name, 'click')
|
||||
|
||||
update: (state) ->
|
||||
@$el.text(state.text)
|
||||
if state.text?
|
||||
window.states[@control_name]['text'] = state.text
|
||||
@$el.text(state.text)
|
||||
|
||||
class WSF_TEXT_CONTROL extends WSF_CONTROL
|
||||
attach_events: ()->
|
||||
@@ -49,7 +50,9 @@ class WSF_TEXT_CONTROL extends WSF_CONTROL
|
||||
trigger_callback(@control_name, 'change')
|
||||
|
||||
update: (state) ->
|
||||
@$el.val(state.text)
|
||||
if state.text?
|
||||
window.states[@control_name]['text'] = state.text
|
||||
@$el.val(state.text)
|
||||
|
||||
#map class name to effectiv class
|
||||
typemap =
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
cache: false
|
||||
}).done(function(new_states) {
|
||||
var name, state, _ref;
|
||||
window.states = new_states;
|
||||
for (name in new_states) {
|
||||
state = new_states[name];
|
||||
if ((_ref = controls[name]) != null) {
|
||||
@@ -66,7 +65,10 @@
|
||||
};
|
||||
|
||||
WSF_BUTTON_CONTROL.prototype.update = function(state) {
|
||||
return this.$el.text(state.text);
|
||||
if (state.text != null) {
|
||||
window.states[this.control_name]['text'] = state.text;
|
||||
return this.$el.text(state.text);
|
||||
}
|
||||
};
|
||||
|
||||
return WSF_BUTTON_CONTROL;
|
||||
@@ -97,7 +99,10 @@
|
||||
};
|
||||
|
||||
WSF_TEXT_CONTROL.prototype.update = function(state) {
|
||||
return this.$el.val(state.text);
|
||||
if (state.text != null) {
|
||||
window.states[this.control_name]['text'] = state.text;
|
||||
return this.$el.val(state.text);
|
||||
}
|
||||
};
|
||||
|
||||
return WSF_TEXT_CONTROL;
|
||||
|
||||
Reference in New Issue
Block a user