Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    TreeGrid drag/drop question

    I have two TreeGrids, grid1 and grid2 with grid1.setDragDataAction(DragDataAction.COPY) and grid2.setAddDropValues(true). Each grid uses a different data source. When I drag a node from grid1 to grid2 the server receives an "update" request for the grid1 data source. I was expecting it to be an "add" request for grid2. What am I misunderstanding?

    #2
    CANCan you show the DataSource definitions and the request you're seeing?

    Comment


      #3
      Here is the data source I'm dragging from ...
      Code:
      <!-- Uses a view that combines IPDIVSN, IPDEPTS and IPCLASS -->
      <DataSource ID="IPMerchHierarchyDS" dataFormat="iscServer"
      	serverType="sql" dbName="as400" tableName="IPMerchHierarchy"
      	serverConstructor="com.islandpacific.gui.server.customDataSource.IpDataSource">
      	<fields>
      		<field name="Name" type="text" canFilter="true">
      			<filterEditorProperties operator="iContains" />
      		</field>
      		<field name="ID" type="integer" primaryKey="true">
      			<filterEditorProperties operator="iStartsWith" />
      		</field>
      		<field name="ParentID" type="integer" rootValue="0"
      			foreignKey="IPMerchHierarchy.ID" />
      		<field name="Type" type="text" length="3">
      			<valueMap>
      				<value ID="DIV">Division</value>
      				<value ID="DPT">Department</value>
      				<value ID="SUB">Sub-department</value>
      				<value ID="CLS">Class</value>
      			</valueMap>
      		</field>
      		<field name="Code" type="integer" detail="true" />
      	</fields>
      </DataSource>
      and here is the one I'm dragging to ...
      Code:
      <DataSource ID="IPClstbHierarchyDS" dataFormat="iscServer"
      	serverType="sql" dbName="as400" tableName="IPClstbHierarchy"
      	serverConstructor="com.islandpacific.gui.server.customDataSource.IpClstbHierarchyDS">
      	<fields>
      		<field name="Name" type="text" canFilter="true">
      			<filterEditorProperties operator="iContains" />
      		</field>
      		<field name="ID" type="integer" primaryKey="true">
      			<filterEditorProperties operator="iStartsWith" />
      		</field>
      		<field name="ParentID" type="integer" rootValue="0"
      			foreignKey="IPClstbHierarchy.ID" />
      		<field name="Type" type="text" length="3">
      			<valueMap>
      				<value ID="DIV">Division</value>
      				<value ID="DPT">Department</value>
      				<value ID="SUB">Sub-department</value>
      				<value ID="CLS">Class</value>				
      			</valueMap>
      		</field>
      		<field name="Code" type="integer" detail="true" />
      	</fields>
      </DataSource>
      and here is the request when dragging
      Code:
      === 2010-01-30 17:22:42,008 [0-12] DEBUG RPCManager - Request #1 (DSRequest) payload: {
          criteria:{
              ID:109
          },
          values:{
              ID:109,
              CKEY:"UJF"
          },
          operationConfig:{dataSource:"IPMerchHierarchyDS", operationType:"update"},
          appID:"builtinApplication",
          operation:"IPMerchHierarchyDS_update",
          oldValues:{
              ID:109,
              CKEY:"UJF"
          }
      }
      I was expecting the request to be an update to the target datasource, not the source. I'm using ListGrid.setDragDataAction(DragDataAction.COPY) on the source list and no drag/drop related settings on the target list. I'm guessing that DragDataAction.MOVE should generate a request to both data sources, but maybe I'm misunderstanding the drag and drop model.

      Comment


        #4
        This is a case we're planning to revise so that a copy take place instead of the attempted "drag recategorize" approach you're seeing.

        You can use setAttribute("dragRecategorize", false) on the target of the drop to avoid this behavior kicking in, and have a copy performed instead.

        Comment


          #5
          There is no method with that signature on TreeGrid. It looks like I need a third parameter, but when I try adding a parameter to match one of the available signatures I get,; The method setAttribute(String, String, boolean) from the type BaseWidget is not visible.

          Comment


            #6
            setAttribute is protected so simply do

            Code:
            TreeGrid grid 2 = new TreeGrid() {{
                setAttribute("dragRecategorize", false, false);  
            }};
            Sanjiv

            Comment

            Working...
            X