1 2 Previous Next 17 Replies Latest reply on Mar 3, 2008 2:11 PM by fmarwede

    scrollableDataTable and multiple drag & drop

      Hello,

      I'm interested in following feature: Select several rows in a scrollableDataTable (with mouse, ctrl and shift - like it works today) and drag & drop them on a tree node. Result: For each dragged and dropped row I get a new node as child of the node with drop zone.

      1.) Is this already possible? Then a short code snippet would be helpful.

      OR

      2.) Is this an aimed feature for 3.2.0 currently not working?

      OR

      3.) Is this a new feature request? Then I would create an issue for that in JIRA.

        • 1. Re: scrollableDataTable and multiple drag & drop

          Perhaps anyone else tried that...?

          • 2. Re: scrollableDataTable and multiple drag & drop

            Still waiting for an answer...

            • 3. Re: scrollableDataTable and multiple drag & drop

              up!

              • 4. Re: scrollableDataTable and multiple drag & drop
                ilya_shaikovsky

                Right now I could give you simple example which used simple selection management to perform Drag and drop of several columns.

                 <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px"
                 width="700px" id="carList" rows="40" columnClasses="col"
                 value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
                 selection="#{dataTableScrollerBean.selection}">
                 <rich:column id="make">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
                 <a4j:outputPanel>
                 <rich:dragSupport dragType="selectionDrag" dragIndicator=":indicator"/>
                 <h:outputText value="#{category.make}" />
                 </a4j:outputPanel>
                 </rich:column>
                 <rich:column id="model">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="Model" /></f:facet>
                 <h:outputText value="#{category.model}" />
                 </rich:column>
                 <rich:column id="price">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="Price" /></f:facet>
                 <h:outputText value="#{category.price}" />
                 </rich:column>
                 <rich:column id="mileage">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="Mileage" /></f:facet>
                 <h:outputText value="#{category.mileage}" />
                 </rich:column>
                 <rich:column width="200px" id="vin">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="VIN" /></f:facet>
                 <h:outputText value="#{category.vin}" />
                 </rich:column>
                 <rich:column id="stock">
                 <f:facet name="header"><h:outputText styleClass="headerText" value="Stock" /></f:facet>
                 <h:outputText value="#{category.stock}" />
                 </rich:column>
                 </rich:scrollableDataTable>
                 <rich:spacer height="20px"/>
                
                 <rich:panel style="width:300px; height:300px">
                 <f:facet name="header">
                 <h:outputText value="Drop Here"/>
                 </f:facet>
                 <rich:dropSupport acceptedTypes="selectionDrag" dropListener="#{dataTableScrollerBean.dropListener}" reRender="table"/>
                 <rich:dataTable value="#{dataTableScrollerBean.droppedCars}" var="sel" id="table">
                 <rich:column>
                 <f:facet name="header"><h:outputText value="Make" /></f:facet>
                 <h:outputText value="#{sel.make}" />
                 </rich:column>
                 <rich:column id="model">
                 <f:facet name="header"><h:outputText value="Model" /></f:facet>
                 <h:outputText value="#{sel.model}" />
                 </rich:column>
                 <rich:column id="price">
                 <f:facet name="header"><h:outputText value="Price" /></f:facet>
                 <h:outputText value="#{sel.price}" />
                 </rich:column>
                 <rich:column id="mileage">
                 <f:facet name="header"><h:outputText value="Mileage" /></f:facet>
                 <h:outputText value="#{sel.mileage}" />
                 </rich:column>
                 <rich:column id="stock">
                 <f:facet name="header"><h:outputText value="Stock" /></f:facet>
                 <h:outputText value="#{sel.stock}" />
                 </rich:column>
                 </rich:dataTable>
                 </rich:panel>
                


                this is the page from demosite and uses beans from demosite.
                One method added

                 public void dropListener(DropEvent event) {
                 System.out.println("Drop Listener Fired");
                 getDroppedCars().clear();
                 Iterator<SimpleRowKey> item = getSelection().getKeys();
                 while (item.hasNext()){
                 SimpleRowKey key = item.next();
                 getDroppedCars().add(getAllCars().get(key.intValue()));
                 }
                 }
                


                There I store the dropped selection..

                Let me know if this example is't enough.

                • 5. Re: scrollableDataTable and multiple drag & drop
                  ilya_shaikovsky

                  sorry.. I means several rows dragging certainly not the columns ;)

                  • 6. Re: scrollableDataTable and multiple drag & drop

                    Thank you very much. But I have some more question:

                    How can I show in the dragIndicator that multiple rows are dragged?

                    There you have inconsistency in developer guide and demo: In the guide there you read that one can define a facet "multy" and in the demo you read about a facet "multiple". But nowhere is explained how to use it.

                    Thanks again for your help, I hope you can help me solve this issue too.

                    • 7. Re: scrollableDataTable and multiple drag & drop

                      up

                      • 8. Re: scrollableDataTable and multiple drag & drop

                        Sorry but this is at least a bug in documentation.

                        • 9. Re: scrollableDataTable and multiple drag & drop

                          The truth is out there...

                          • 10. Re: scrollableDataTable and multiple drag & drop

                            Problem is still up to date.

                            • 11. Re: scrollableDataTable and multiple drag & drop

                              New week, new try.

                              • 12. Re: scrollableDataTable and multiple drag & drop

                                up

                                • 13. Re: scrollableDataTable and multiple drag & drop

                                  Please...

                                  • 14. Re: scrollableDataTable and multiple drag & drop
                                    maksimkaszynski

                                    Hmm. Looks like its type 3 :)
                                    Problem is that drag indicator is entirely formed on client, and scrollable data table maintains its selection on server, so we need to
                                    a) either perform round-trip to server to find out how many lines are selected
                                    b) or maintain selection on client as well.

                                    1 2 Previous Next