benefits of gwtQuery

后端 未结 2 2037
轮回少年
轮回少年 2021-01-28 08:34

Can somebody tell me what are the benefits of using gwt query .Is it just for css effects. and how we can use it to create ui elemnts like gwt.

What I understand is ju

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-28 09:28

    GQuery is much more than that. You can navigate into de DOM fast and easy (like jQuery), for example!

    Look, this morning I used it in that way:

    Element p = DOM.createElement("p");
    p.addClassName("KV");
    p.setInnerText(newBody);
    $(cellList + " #__idx=\""+position+"\" p .KV").replaceWith(p);
    

    If you take a look into the last line you´ll see: The related DOM for the widget cellList (CellList from MGWT), search the element that has the id "__idx" then select elements p and from them the elements that have the class "KV".

    Have you thought the code in normal gwt for this?

    Other really useful thing that you can use is the Promise pattern. Something like do A if B has finished correctly, and do B if C has finished correctly. We are using this for oAuth authentication in our app. Believe if you deal with Facebook OAuth in one line you can be sure everythings is fine.

    If you are not using GQuery, you probably need to create 4 Callbacks with its onSuccess and onFailure methods (Spaguetti code).

    And many more things...

    Also important people from Google and Opensource community is under that project, and this is a good sign.

提交回复
热议问题