Jsfのajaxタグのoneventでbegin/complete/successを makes う

Source: Internet
Author: User

Primefacesに accustomed れてしまって, usually のhtmlタグでの method がわからなかったりする point があった ... ので, メモ.

ajaxでリクエスト Messenger のタイミングやレスポンスが 戻 るタイミングに ho らか (javascriptなどで) Hishinuma in れたいことがあります.

This time from the example of では, テキストのフォーカスアウト time にajaxで Hishinuma, してからレスポンスが 戻 るまでの the occupies screen operation をブロックしたい. というものでした.

リクエストの Messenger にブロックuiを out 前転して開脚座り, レスポンス when the letter にブロックuiを release able, イメージです.

Picture で Ming すると

テキストがあって

The force of text to enter

フォーカスアウトするとajaxで Hishinuma accolades out 前転して開脚座り, その は screen ブロック

Ajaxのレスポンスが 戻 といった Time point でブロックが えて operation が Stream できる.

で, usually こうした Hishinuma ではajaxタグにあるonevent attribute of the うようです.
The following, Natsumi Sato International にお try しで book いたビュー↓

<?xmlVersion=' 1.0 'encoding=' UTF-8 '?><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en""Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ><Htmlxmlns="Http://www.w3.org/1999/xhtml"Xmlns:h="Http://java.sun.com/jsf/html"xmlns:p="Http://primefaces.org/ui"Xmlns:pe="Http://primefaces.org/ui/extensions"xmlns:f="Http://java.sun.com/jsf/core"Xmlns:ui="Http://java.sun.com/jsf/facelets">:head><Title>フォーカスブロックのサンプル</Title>:head>:body>: FormId="frm"><!--primefaces extensionのblockuiコンポーネント--><pe: BlockuiTarget="frm"Widgetvar="BLC">:p Anelgrid columns="2"><P: GraphicimageId="IMGLOADERBLC"library="Images"  Name="Ajax-loader.gif" Width="15px" Height="15px"/>: OutputlabelId="Lblblcprocessing"  Value="Hishinuma in だよー" Style="FONT-SIZE:0.6EM;"/>:p anelgrid></pe:blockui><!--into force テキストとajaxによるチェンジイベント-->: InputtextId="Txtinput" Value="#{indexbean.inputval}"><f: Ajax event="Change"Listener="#{indexbean.calc ()}"Render="@form"  Onevent= "Focusblock"/>:inputtext>:form><!--Block Uiの outbound し--><Script Type="Text/javascript"> functionFocusblock (Data{ VarAjaxstatus = data.Status; Statusで Hishinuma moistened points ける SwitchAjaxstatus){ Beginだったらブロックuiを says Case "Begin":Blc.block (); Break //completeだったらブロックuiを release  case " complete ": Blc.unblock () ; break; } } </script> :body></ html>          

Ajaxタグのonevent attribute でjavascriptの Hishinuma びますが, その in でstatusをみてbegin/completeの hishinuma the books いてます. With じようにsuccessも make えるようです.

Know らなかった ... (^^;

ちなみにprimefacesを use しているとjavascriptの が do not でinputtextの part が the developed book けます.

<P: InputtextId="Ptxtinput" value= " #{indexbean.inputval} "> < p:ajax event= "change"  Listener= "#{indexbean.calc ()}"  Update= "@form"   onstart=" Blc.block () ; "  oncomplete= "Blc.unblock () ;" /></p:INPUTTEXT>            

Primefacesの Hiroki Zhang Ajaxタグだとupdate property が usually のrender property にあたり, さらに property でonstart/oncompleteが specify できます. さらにonsuccessも exists します.

Natsumi Sato line すると with じです. (ただし below はテキストもprimefacesのコンポ)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.