D
D
dshvechikov2013-01-11 12:24:14
JavaScript
dshvechikov, 2013-01-11 12:24:14

Working with Wicket WiQuery Selectable?

The project uses wicket, you need to make a selection of images. Of course, the choice fell on jquery selectable and its implementation under wicket.

There is this code

SelectableAjaxBehavior selectableAjaxBehavior = new SelectableAjaxBehavior() {<br>
<br>
            private static final long serialVersionUID = 1L;<br>
<br>
            @Override<br>
            public void onSelection(Component[] components, AjaxRequestTarget ajaxRequestTarget) {<br>
                System.out.println("SIZE: " + components.length);<br>
            }<br>
        };<br>
        selectableAjaxBehavior.getSelectableBehavior().setSelectedEvent(new JsScopeUiEvent() {<br>
            @Override<br>
            protected void execute(JsScopeContext scopeContext) {<br>
                scopeContext.append("console.log('ID: ' + ui.selected.id);");<br>
            }<br>
        });<br>
        selectableAjaxBehavior.setFilter(".tooth-image");<br>
        add(selectableAjaxBehavior);<br>


The bottom line is that I can’t figure out how to make sure that an array of components comes to the onSelection method, because in the current version, an empty array comes all the time. In the setSelectedEvent method, the ids of the selected images are normally displayed in the browser console.

Do you have any ideas or has anyone experienced something similar?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question