0 Replies Latest reply on Nov 27, 2007 1:28 AM by KironeX

    drag to DataGrid and Insert

      I posted this already on the flex 2 forums didnt see the flex 3 forum so hopefully you guys can help me get abit closer to the answer


      Is it possible to do an insert action into the database when drag is complete

      I have a dataGrid that holds the original data and want to drag this data into a new datagrid the moment the drag is complete it should be inserted into the database and then the usual edits can be done to the data (the last part i have working)


      Originally posted by: atta707
      Yes. Absolutely possible.

      Is your first datagrid already writing to DB? If so that's exactly how the second one write it to DB once drag and drop is complete; using dragDrop event.

      If that's not the case, you need to elaborate a bit more what situation you're in.


      Originally posted by: KironeX
      my first is getting it's data from a db and i can edit the fields and it will also store it to db again but i cant figure out how the dragDrop eventcould/should activate the insert record action

      i tried to do it like this but it didnt insert to dataBase

      private function insertItem(e:AdvancedDataGridEvent):void {
      var dsRowIndex:int = e.rowIndex;
      var dsFieldName:String = e.dataField;
      var dsColumnIndex:Number = e.columnIndex;

      var vo:* = dataArr[dsRowIndex];

      var col:AdvancedDataGridColumn = dataGrid.columns[dsColumnIndex];
      var newvalue:String = dataGrid.itemEditorInstance[col.editorDataField];

      trace("a:" + dsRowIndex + ", " + dsFieldName + ", " + dsColumnIndex);

      var parameters:* =
      "id": vo.idCol, "naam": vo.naamCol, "aantal": vo.aantalCol, "categorie": vo.categorieCol, "prijs": vo.prijsCol, "searchkey": vo.searchkeyCol }

      parameters[dsFieldName.substr(0,dsFieldName.length-3)] = newvalue;

      doRequest("Insert", parameters, insertItemHandler);