开发者

Mixing Ext JS and Wicket

开发者 https://www.devze.com 2022-12-20 20:08 出处:网络
I have a problem related to Wicket and Ext JS. I have a text field in Ext JS and I want to add a Wicket ID to i开发者_C百科t. In Ext JS, text fields have limited properties. How can I do this?There ar

I have a problem related to Wicket and Ext JS. I have a text field in Ext JS and I want to add a Wicket ID to i开发者_C百科t. In Ext JS, text fields have limited properties. How can I do this?


There are at least two projects trying to integrate ext js into wicket:

http://code.google.com/p/wicket-extjs-integration/ gpl :(

http://code.google.com/p/wicket-ext/ apache license :)


You'll have to use the DOM to add custom attributes to the markup. See Ext.Element.


If you want to add a wicket:id then I presume that you are wanting to add a wicket component with that wicket:id to your page / component. For this to work that wicket:id will need to be present in the html for your page / component at render time. Therefore adding it to the DOM with javascript wont help you as wicket will never see it.

There are a few ext-js wicket integrations which may help you, but I haven't used them. Try searching on the wicket mail list: http://old.nabble.com/Apache-Wicket-f13974.html


The wicket-extjs-integration project is now available under the Apache license. Licensing is a tricky subject, however, due to the fact that ExtJS code itself is GPL. For details, see http://code.google.com/p/wicket-extjs-integration/wiki/Licensing.

The way we (Hippo) use it mostly is by letting the wicket component

  1. set up the configuration and

  2. implement component-bound services for the Ext component; e.g. a read/write JsonStore can be implemented in pure java.

It's also easy to subscribe to Ext events with a (java) event listener.

Typically, the Wicket component only needs to bootstrap the Ext component. However, we've also had a few cases where we then needed to wrap a Wicket component in an Ext component. This is also quite easily accomplished. (see our Channel Manager code @ http://svn.onehippo.org/repos/hippo/hippo-cms7/addons/addon-channel-manager/trunk/)

Being able to compose the Ext component hierarchy has allowed us to extend our Wicket-based plugin mechanism to the Ext side. E.g. Wicket plugins each instantiate a card/panel Ext component & those are aggregated on the wicket side in a component that instantiates an Ext tab panel.

The method annotation you mention is something we haven't needed; we typically trigger client-side code by emitting javascript code. Probably a cleaner solution would be to fire an event.

The versions of Wicket and ExtJS used are a bit antiquated (1.4.xx & 3.4.x), something we'll be addressing on a short term.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号