-
1. Re: InplaceSelect - value of component is previous when onch
hjshin May 6, 2009 10:57 PM (in response to hjshin)"hjshin" wrote:
hello.
version : 3.3.1.CR2HtmlInplaceSelect input = (HtmlInplaceSelect) application. createComponent(HtmlInplaceSelect.COMPONENT_TYPE); String eventType = "onchange"; input.setValueExpression("value", factory.createValueExpression(facesContext.getELContext(), "#{report.parameters." + key + "}", Object.class)); HtmlAjaxSupport ajaxSupport = new HtmlAjaxSupport(); ajaxSupport.setId("test_support"); ajaxSupport.setEvent(eventType); ajaxSupport.setDisableDefault(true); ajaxSupport.setOncomplete("afterReportSearch(this)"); ajaxSupport.setReRender(parentHandler.getReRenderTarget()); ajaxSupport.setActionExpression(factory.createMethodExpression( facesContext.getELContext(), "#{reportViewer.searchReport}", Void.TYPE, new Class[] {}));
when value change, component has the value( -> #{report.parameters." + key + "}" ) what is previous value in action ( -> #{reportViewer.searchReport} ). -
2. Re: InplaceSelect - value of component is previous when onch
hjshin May 7, 2009 3:08 AM (in response to hjshin)when i change code of inplaceselect.js. it's working.
** original setValue : function(e, param) { var item = {}; item.itemValue = this.getParameters(e,param,"value"); if(this.showValueInView) { item.itemLabel = item.itemValue; } else { item.itemLabel = this.findLabel(this.comboList.itemsText,item.itemValue); } if (!item.itemLabel) { item.itemValue = this.currentItemValue; item.itemLabel = this.tempValueKeeper.value; } var value = this.valueKeeper.value; if (Richfaces.invokeEvent(this.events.onviewactivation, this.inplaceInput, "rich:onviewactivation", {oldValue : this.valueKeeper.value, value : item.itemValue})) { var proceed = true; ------------------------------> this part can move after value bind -----------------------------> if(item.itemLabel && value != item.itemValue) { proceed = Richfaces.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange", item.itemValue); } } ------------------------------> if(proceed) { this.endEditableState(); if (!item.itemValue || item.itemValue.blank()) { item.itemValue = ""; } if (!item.itemLabel || item.itemLabel.blank()) { item.itemLabel = this.attributes.defaultLabel; } this.valueKeeper.value = item.itemValue; this.currentText = item.itemLabel; this.tempValueKeeper.value = item.itemLabel; if (item.itemValue != this.value) { this.startChangedState(); } else { this.startViewState(); } if (this.events.onviewactivated) { this.inplaceInput.fire("rich:onviewactivated", {oldValue : value, value : this.valueKeeper.value}); } } else { this.cancel(); } --------------------------------> here },
** update setValue : function(e, param) { var item = {}; item.itemValue = this.getParameters(e,param,"value"); if(this.showValueInView) { item.itemLabel = item.itemValue; } else { item.itemLabel = this.findLabel(this.comboList.itemsText,item.itemValue); } if (!item.itemLabel) { item.itemValue = this.currentItemValue; item.itemLabel = this.tempValueKeeper.value; } var value = this.valueKeeper.value; if (Richfaces.invokeEvent(this.events.onviewactivation, this.inplaceInput, "rich:onviewactivation", {oldValue : this.valueKeeper.value, value : item.itemValue})) { var proceed = true; if(proceed) { this.endEditableState(); if (!item.itemValue || item.itemValue.blank()) { item.itemValue = ""; } if (!item.itemLabel || item.itemLabel.blank()) { item.itemLabel = this.attributes.defaultLabel; } this.valueKeeper.value = item.itemValue; this.currentText = item.itemLabel; this.tempValueKeeper.value = item.itemLabel; if (item.itemValue != this.value) { this.startChangedState(); } else { this.startViewState(); } if (this.events.onviewactivated) { this.inplaceInput.fire("rich:onviewactivated", {oldValue : value, value : this.valueKeeper.value}); } } else { this.cancel(); } if(item.itemLabel && value != item.itemValue) { proceed = Richfaces.invokeEvent(this.events.onchange, this.inplaceSelect, "onchange", item.itemValue); } } },
-
3. Re: InplaceSelect - value of component is previous when onch
ilya_shaikovsky May 7, 2009 5:19 AM (in response to hjshin)inplace components has special events for processing the new value or checking the state changing..
onviewactivated/oneditactivated
onviewactivation/oneditactivation -
4. Re: InplaceSelect - value of component is previous when onch
hjshin May 7, 2009 10:48 PM (in response to hjshin)hello.
when i use onviewactivated event,
it's submitted(changed) with click the inplaceselect(i click the component for show), not with the value change.
how can i submit when the value of the inplaceselect change only.
sorry about poor english.
thanks. -
5. Re: InplaceSelect - value of component is previous when onch
ilya_shaikovsky May 8, 2009 8:33 AM (in response to hjshin)http://livedemo.exadel.com/richfaces-demo/richfaces/inplaceSelect.jsf
see last sample. do not pay attention to custom buttons. It will works the same without them. -
6. Re: InplaceSelect - value of component is previous when onch
hjshin May 10, 2009 10:13 PM (in response to hjshin)hi,
could u test this..
component: inplaceselect
control : visible = false
event: onviewactivated
action: some method in java(ex: searchReport)
test : click the component and show list(suggestionbox) and then just click another part for close the list(suggestionbox) not select value. at this time(just close the list) act searchReport method.
i think view activated...so event happens.
i want some action when the value changed.
in this case may i use onchange event??? but i cound not use the onchange event because when i use onchange event i get a previos value(see previous post)
thanks. -
7. Re: InplaceSelect - value of component is previous when onch
ilya_shaikovsky May 11, 2009 7:33 AM (in response to hjshin)you could define not action but valueChangeListener.. then it will be fired only on value changed. (but request will be still nivoked.)
or you could store the inplace value and check if it changed on onsubmit in order to prevent unnesessary request.
anyway you're right.. It not looks fine https://jira.jboss.org/jira/browse/RF-7079