Datagrid editable row

Hi,
I would like to know if there is a way to make an entire row in a datagrid editable when that row is selected.  Currently when a user selects a cell of the row, only that cell becomes editable.  I would like to have that entire row become editable.  Is there a way of accomplishing this?  Thanks in advance.

Hi,
Just gave your code a try and, although I did not implement the ITEM_EDIT_END yet, the editor does not do anything in terms of clicking on a row and "enabling" the textfields for that row.  Below is my code along with yours:
package
    public class TestBean
        [Bindable] private var _processDefName:String;
        [Bindable] private var _processGroupName:String;       
        [Bindable] private var _processSomeName:String;
        public function get processDefName():String {
            return _processDefName;
        public function set processDefName(value:String):void {
            _processDefName = value;
        public function get processGroupName():String {
            return _processGroupName;
        public function set processGroupName(value:String):void {
            _processGroupName = value;
        public function get processSomeName():String {
            return _processSomeName;
        public function set processSomeName(value:String):void {
            _processSomeName = value;
package
import flash.events.FocusEvent;
import mx.controls.Alert;
import mx.controls.DataGrid;
import mx.controls.TextInput;
import mx.controls.dataGridClasses.DataGridColumn;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.controls.listClasses.IDropInListItemRenderer;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.UIComponent;
import mx.managers.IFocusManagerComponent;
      Two TextInput Editor for DataGrid
public class DataGridMultiFieldEditor extends UIComponent implements IListItemRenderer, IDropInListItemRenderer, IFocusManagerComponent
     private var dgOwner:DataGrid;
     private var textEditors:Array = []
     public function DataGridMultiFieldEditor()
          super();
     public function get fullValue():String
          dgOwner = owner as DataGrid;
          var colInd:Number = dgOwner.editedItemPosition.columnIndex;
          return TextInput(textEditors[colInd]).text;
     private var _data:Object;
     public function get data():Object
          return _data;
     public function set data(value:Object):void
          _data = value;
          invalidateProperties ();
     private var _listData:BaseListData;
     public function get listData():BaseListData
          return _listData;
     public function set listData(value:BaseListData):void
          _listData = value;
     override public function setFocus():void
     override protected function createChildren():void
          dgOwner = owner as DataGrid;
          super.createChildren ();
        var child:TextInput;
          textEditors = new Array();
        var n:int = dgOwner.columns.length;
        for (var i:int = 0; i < n; i++)
            child = new TextInput();
            textEditors.push(child)
            addChild(child);
     override protected function commitProperties():void
          dgOwner = owner as DataGrid;
          super.commitProperties();
        var n:int = dgOwner.columns.length;
        for (var i:int = 0; i < n; i++)
              var dgColumn:DataGridColumn = dgOwner.columns[i];
              var value:String = data[dgColumn.dataField];
              TextInput(textEditors).text = value;
     override protected function updateDisplayList(w:Number, h:Number):void
          dgOwner = owner as DataGrid;
          super.updateDisplayList(w, h);
        var n:int = dgOwner.columns.length;
        var xx:Number = 0;
        for (var i:int = 0; i < n; i++)
             TextInput(textEditors).move(xx, 0);
            var ww:Number = dgOwner.columns.width;
             TextInput(textEditors).setActualSize(ww, h);
            xx += ww;
     private function keyFocusChangeHandler(event:FocusEvent):void
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute"
    creationComplete="init();">
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            [Bindable] private var col:ArrayCollection = new ArrayCollection();
            private function init():void {
                var tbA:TestBean = new TestBean();
                tbA.processDefName = "A";
                tbA.processGroupName = "Group A";
                tbA.processSomeName = "AAAAAAAA";
                var tbB:TestBean = new TestBean();
                tbB.processDefName = "B";
                tbB.processGroupName = "Group B";
                tbB.processSomeName = "BBBBBBBB";
                col.addItem(tbA);
                col.addItem(tbB);               
        ]]>
    </mx:Script>  
    <mx:VBox>
        <mx:DataGrid editable="true" id="dg" dataProvider="{col}" width="300">
            <mx:columns>
                <mx:DataGridColumn width="100" editable="true" dataField="processGroupName" headerText="NAME" editorWidthOffset="200" itemEditor="DataGridMultiFieldEditor" editorDataField="fullValue"/>
                <mx:DataGridColumn width="100" editable="true" dataField="processDefName" headerText="TYPE" editorXOffset="-100" editorWidthOffset="200" itemEditor="DataGridMultiFieldEditor" editorDataField="fullValue" />
                <mx:DataGridColumn width="100" editable="true" dataField="processSomeName" headerText="MISC" editorXOffset="-200" editorWidthOffset="200" itemEditor="DataGridMultiFieldEditor" editorDataField="fullValue"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:VBox>
</mx:Application>

Similar Messages

  • DataGrid Editing / saving back to server using Checkbox

    Hi
    I am new to flex.
    I want to load an xml to a datagrid.
    I need to populate the grid with check box so that user's can select the reequired rows,add and even add new rows and then save it back to server.

    Hi
    Still i am not able to get.
    can you suggest me.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
        <mx:Script>
            <![CDATA[
                import mx.rpc.events.ResultEvent;
                import mx.rpc.events.FaultEvent;
                import mx.collections.XMLListCollection;
                import mx.controls.Alert;
                               [Bindable]
                               private var dataValue:XMLListCollection;
                public function handleXML(event:ResultEvent):void
                    dataValue = event.result.root.sample as XMLListCollection;
                public function handleFault(event:FaultEvent):void
                   Alert.show(event.fault.faultString, "Error");
            ]]>
        </mx:Script>
        <mx:HTTPService result="handleXML(event);" fault="handleFault(event);" id="xmlRPC" resultFormat="e4x"
            url="http://localhost:8080/InfraLabWebApp/properties.xml" useProxy="false">
        </mx:HTTPService>
        <mx:Button x="130" y="95" label="Submit" click="xmlRPC.send();" width="160" height="22"/>
        <mx:DataGrid
            dataProvider="{dataValue}"
            x="80" y="141" width="262" height="92" id="dataGrid" editable="false" enabled="true">
        </mx:DataGrid>
    </mx:Application>
    MY XML IS
    <?xml version="1.0" encoding="UTF-8" ?>
    <root>
    <sample>
         <name>TV</name>
         <price>25000</price>
    </sample>
    <sample>
         <name>TV1</name>
         <price>25000</price>
    </sample>
    <sample>
         <name>TV2</name>
         <price>25000</price>
    </sample>
    </root>

  • Adding an editable row in an non editable table.

    Hi,
    My requirement is to add an Editable row in a table which is in display mode only, i mean i cannot edit the data that is present in the table.
    But if the user presses the Add Row button on the Table Toolbar, a new editable row should be added in the end, so that he can save the new data entered.
    methods tried:
    1: I have used Inputfield as Cell Editors, with their Read only Property check marked, thougt that with the new element created, it would not be Read Only.
    2: Binded the read only property with a context attribute, but still was not able to achieve this functionality.
    3: Tried the above two steps with the "Enabled" property of the Table Coloumn Cell Editors as well, but no result.
    Please give me some pointers on this.
    Regards,
    Ashish

    Hi Ashish,
    The approach you were following was correct, but I am not sure where you have placed the Enabled property attribute in the context.
    Please follow these steps:
    1. The table you are creating should have the enabled property set.
    2. The context with you are binding the table should have an additional attribute say ISENABLED of type boolean.
    3. Bind this attribute with the ENABLED property of all the input enabled fields in your table.
    4. When binding the non-editable data into the table, set this property to ABAP_FALSE for each record. This will make the existing data non editable.
    5. Use the below code for adding a new row and set the ISENABLE property of the added row to ABAP_TRUE.
        elem_table = node_table->create_element( ).
        node_table->bind_element( new_item =  elem_table set_initial_elements = abap_false ).
        stru_table-isenable = abap_true .
        elem_new_row->set_static_attributes( static_attributes = stru_table ).
    Let me know how you go about it.
    Cheers,
    Pratibha

  • Datagrid last row flickering problem.

    Hi,
        I used flex 3.5 datagrid. It is a complex datagrid with lot of itemrenderers and itemeditors.when my datagrid has vertical scroll and when i scroll datagrid, last row keep on flickering.
         any idea or solution for this problem?   

    my grid contains 6 columns. Among 6, some of the column texts are  visible some of them hided.
    it is only happens to last row of the Datagrid.
    This is happened when i scroll my datagrid vertically.

  • Report with editable rows

    Hi,
    I have a strange requirement, i am creating a tool for uploading the excel sheets.In the run time it will create the table which will be like user_name concatenated with date and time. so, everytime a user logs in, the table will be created based on his user name and the columns will be the headers in the excel sheet. My problem is i want make the row as an editable row whenever the user checks the checkbox and clicking on the edit button. I should be able to update the particular row in the table. Is it possible in htmldb to make the particular row an editable mode and update it? The problem is the table is created dynamically and we can the catch the table name only in the runtime. If it is not possible can you suggest some other way to overcome this? Please provide me a solution as this is a high priotity issue for me.
    Thanks,
    Ramky

    I guess I misunderstood. You're saying that each user will upload a file, but that every single file may have a different number of columns? So the only way you can tell is to read the first line, and create a column for every single heading in the file?
    What I'm not understanding is when you say you will upload the file, but maybe need to make changes. However the next time the person logs in or needs to upload a new file, you drop the old table. If you are dropping the old table, what changes need to be made between the time they are uploaded and dropped? Couldn't you just let the user load the file in again?
    The only reason I ask is that dynamic pl/sql is kind of a pain to work with, and if there was a static way for you to do this, I would personally lean toward that approach. Maybe you can explain exactly what the process does in simple terms and I can help out a bit more.

  • Editing rows and columns in alv reports in webdynpro abap

    how edit row and columns in webdynpro abap ?
    can i add colors to salv repotrs for below and above range of values  how ?
    if possible send source code for it.............

    hi
    check out this link for editing the columns of ALV
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b
    check out for this thread as well for coloring ALV
    Coloring of selected table cells: Ideas wanted
    regards,
    amit

  • How to edit row in alv

    sir,
      explain me how to edit row in alv report in particular column.

    put in the fieldcatalog;;
    wa_fieldcat-edit = 'X'.
    wa_fieldcat-fieldname = 'NETPR'.
    wa_fieldcat-scrtext_m = 'Net Price'.
    wa_fieldcat-edit = 'X'. "sets whole column to be editable
    wa_fieldcat-col_pos = 7.
    wa_fieldcat-outputlen = 15.
    wa_fieldcat-datatype = 'CURR'.
    APPEND wa_fieldcat TO it_fieldcat.
    CLEAR wa_fieldcat.

  • Edit rows of alv

    Hi,
    is it possible to have editable rows in an alv? I mena really the whole row, not a cell.

    Hello
    Since you want to make the entire row editable this is much easier than individual cells:
    FORM set_editable_rows.
    DATA:
      lt_celltab            TYPE lvc_t_styl,
      lt_celltab_edit    TYPE lvc_t_styl,
      ls_cell                TYPE lvc_s_styl,
    ls_fcat                TYPE lvc_s_fcat,
    ls_outtab           LIKE LINE OF gt_outtab.  " itab for ALV display
    " Prefill LT_CELLTAB with all columns
      REFRESH: lt_celltab,
                       lt_celltab_edit.
      LOOP AT gt_fcat INTO ls_fcat.  " gt_fcat holds the fieldcatalog
        CLEAR: ls_cell.
        ls_cell-fieldname = ls_fcat-fieldname.
        ls_cell-style = cl_gui_alv_grid=>mc_style_enabled.
        INSERT ls_cell INTO TABLE lt_celltab_edit.  " NOTE: SORTED table type !!!
        ls_cell-style = cl_gui_alv_grid=>mc_style_disabled.
        INSERT ls_cell INTO TABLE lt_celltab.  " NOTE: SORTED table type !!!   
      ENDLOOP.
      LOOP AT gt_outtab INTO ls_outtab.
        IF ( <condition is met for setting row editable> ).
          ls_outtab-celltab = lt_celltab_edit.
        ELSE.
          ls_outtab-celltab = lt_celltab.  " non-editable
        ENDIF.
        MODIFY gt_outtab FROM ls_outtab INDEX syst-tabix.
         TRANSPORTING celltab
      ENDLOOP.
    ENDFORM.
    Regards
      Uwe

  • Load xml to Datagrid, add row or edit and save it to the xml file??

    Good afternoon,
    I know how to load the xml, add a row or edit the data in a datagrid . Only thing I dont't  know
    how to save the changes to the xml file. I'm ussing Flash Professional CC and it wil be an Adobe Air
    desktop application.

    Hi, and thank for the reply. Problem is not saving the xml, but getting the edited or new rows in the datagrid  to be saved in the xml.....

  • How To Update Custom ItemRenderer (Image) on DataGrid Edit

    I have an DataGrid with 2 columns, column 1 called "Name" and column 2 called "Actions".
    The "Name" column contains editable text and the "Actions" column uses a (inline) custom ItemRenderer which displays 2 icon images ( for Edit and Delete). All works fine. Clicking Edit or Delete calls the corrosponding outerDocument method.
    The feature I am trying to add is as follows: when someone double-clicks on the text in the Name column to edit it, I would like the edit icon in the Actions column to ( grow/shrink, change color  - or some such indication/reminder to click it ). Not seeing how to do this with the inline ItemRenderer, I created a custom item renderer class and, in that class, use mx:Resize to perform the "grow/shrink". I created a method called "pulse()" and, from within that renderer, all works well. ( for testing, I wired the icons click event to the pulse() method ). However, now I am not sure how to call that ItemRenderers "pulse()" method to perform the effect from the main DataGrid (when the user double-clicks on Name field to edit).
    The tried using the DataGrid's "itemEditBegin", which fires correctly, but from that point I am not sure how to access the selected rows edit icon in the "Action" column. ( to call its pulse() ) method.
    So any suggestions how I can achieve my end result? Being able to manipulate the edit icon in the "Actions" column, when the user double-clicks (edits) that row's "Name" column?
    If I'm going about it all wrong, feel free to offer alternative solutions.
    Any help would be appreciated.
    Thanks,
    ~e

    Hi,
      Check the  BAPI_MATERIAL_SAVEDATA ,in the BAPI  is there a table parameter EXTENSIONIN ?
    which you can use to pass the values for user defined fields to the BAPI..
    Regards
    Kiran Sure

  • DataGrid Moving rows up and down

    I have this function to move rows up in a datagrid , yet i am having problems when it comes to move to rows down. I have tried changing the following line to +1 but it dint work any hints please.
                ac.addItemAt(itemToShift,dg.selectedIndex-1);
    This is the code
    public function up():void
                if(dg.selectedIndex == -1)
                    Alert.show("Select the row which you want to up.");
                    return;
                if(dg.selectedIndex == 0)return;
                var selectedRowInx : Number = dg.selectedIndex;
                var itemToShift : Object = ac.getItemAt(selectedRowInx) as Object;
                ac.addItemAt(itemToShift,dg.selectedIndex-1);
                ac.removeItemAt(dg.selectedIndex);
                dg.invalidateDisplayList();

    Okay.  So, I made the code a little simpler than what I said. With my code, you could have selected a row, clicked a cut button, then selected a another row to past afterwards or whatever.  Here is the code for simply moving the row up and down.
    I added code to catch if the row was at the top or the bottom of the data.  Also, I created two indexes, one for the grid and one for the array collection.  It will probably work with the one index, but I was trying to see if I could do the move on a sorted datagrid, but that is basically pointless.
    protected function moveUpBtn_clickHandler(event:MouseEvent):void
    var upSelectedIndex:int = myDataGrid.selectedIndex;
    // Move Item
    if(upSelectedIndex > -1) {
      if(upSelectedIndex > 0) {
       // Get the selected Object
       var moveObject:Object = myArrayCollection.getItemAt(upSelectedIndex);
       // Get actual Object location if grid is sorted
       var upActualIndex:int = myArrayCollection.getItemIndex(moveObject);
       // Remove selected item at actualIndex
       myArrayCollection.removeItemAt(upActualIndex);
       myArrayCollection.refresh();
       // Move both indexes
       upActualIndex--;
       upSelectedIndex--;
       // insert item at actualIndex
       myDataGrid.dataProvider.addItemAt(moveObject, upActualIndex);
       myArrayCollection.refresh();
       // select grid at selectedIndex
       myDataGrid.selectedIndex = upSelectedIndex;
      } else {
       Alert.show("Item is currently at the top of the list.", "Move Alert",  Alert.OK, this);
    } else {
      Alert.show("No Item Selected.", "Move Alert",  Alert.OK, this);
    protected function moveDownBtn_clickHandler(event:MouseEvent):void
    var downSelectedIndex:int = myDataGrid.selectedIndex;
    if(downSelectedIndex > -1) {
      // Move Item
      if(downSelectedIndex < myArrayCollection.length -1) {
       // Get the selected Object
       var moveObject:Object = myArrayCollection.getItemAt(downSelectedIndex);
       // Get actual Object location if grid is sorted
       var downActualIndex:int = myArrayCollection.getItemIndex(moveObject);
       // Remove selected item at actualIndex
       myArrayCollection.removeItemAt(downActualIndex);
       myArrayCollection.refresh();
       // Move both indexes
       downActualIndex++;
       downSelectedIndex++;
       // insert item at actualIndex
       myDataGrid.dataProvider.addItemAt(moveObject, downActualIndex);
       myArrayCollection.refresh();
       // select grid at selectedIndex
       myDataGrid.selectedIndex = downSelectedIndex;
      } else {
       Alert.show("Item is currently at the bottom of the list.", "Move Alert",  Alert.OK, this);
    } else {
      Alert.show("No Item Selected.", "Move Alert",  Alert.OK, this);
    Here is the blog post with the working DataGrid and Source View
    Message was edited by: DeanLoganBH  - Had to set the Down Move to look for the Length of the ArrayCollection -1, because the DataGrid row starts at 0, it is one less than the total length of the ArrayCollection.

  • How to get edited row values from ADF table?

    JDev 11.
    I have a table which is populated with data from Bean.
    I need to save changes after user make changes in any table cell. InputText is defined for table column component.
    I have defined ValueChangeListener for inputText field and AutoSubmit=true. So when user change value in inputText field, method is called:
    public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
    getSelectedRow();
    SaveMaterial(material);
    This method should call getSelectedRow which take values from selected table row and save them into object:
    private Row getSelectedRow(){
    RichTable table = this.getMaterialTable();
    Iterator selection = table.getSelectedRowKeys().iterator();
    while (selection.hasNext())
    Object key = selection.next();
    table.setRowKey(key);
    Object o = table.getRowData();
    material = (MATERIAL) o;
    System.out.println("Selected Material Desc = "+material.getEnumb());
    return null;
    Problem is that getSelectedRow method doesnt get new (edited) values, old values are still used.
    I have tried to use ActiveButton with same method and it works fine in that case. New values are selected from active row and inserted into object.
    JSF:
    <af:table var="row" rowSelection="single" columnSelection="single"
    value="#{ManageWO.material}" binding="#{ManageWO.materialTable}">
    <af:column sortable="false" headerText="E-number">
    <af:inputText value="#{row.enumb}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
    </af:column>
    <af:column sortable="false" headerText="Description">
    <af:inputText value="#{row.desc}" valueChangeListener="#{ManageWO.SaveMaterial}" autoSubmit="true"/>
    </af:column>
    </af:table>
    <af:activeCommandToolbarButton text="Save" action="#{ManageWO.EditData}"/>
    What is a correct place from where save method should be called to get new (edited) values from ADF table?
    Thanks.

    Did you look into the valueChangeEvent?
    It has oldValue and newValue attributes.
    public void SaveMaterial(ValueChangeEvent valueChangeEvent) {
    Object oldVal = valueChangeEvent.getOldValue();
    Object newVal = valueChangeEvent.getNewValue();
    // check if you see what you are looking for.....
    getSelectedRow();
    SaveMaterial(material);
    }Timo

  • Datagrid change row event with tab AND/OR click ???

    I have a spark datagrid with the last two columns enterable.
    The natural approach for the user is to click in one and enter it then keep tabbing from cell to cell row to row to do his/her data entry.
    Selectionchanging works only if you click, the selection does not keep up with the tab from row to row.
    I want to enter the new data for each row when the user leaves the row.
    What is the best way to approach this particular (and common) need.
    Thanks
    Dan Pride

    Hi again,
    I think I was not clear enough. Basically I have a textfield assigned with a style, let's say TextFieldStyle1. What I want is to programmatically assign the textfield another style, say, TextFieldStyle2.
    How can I achieve that ?
    Many thanks !

  • Datagrid editable problem

    hi
    I am having a datagrid in which one particular column is editable.This column fetches decimal values from database.Although i have set the editable property as true I am not able to edit the column .Only if i press backspace I am able to edit it .kindly help me to solve it.
    <mx:DataGrid 
    width="816" dataProvider="arr" id="g1" editable="
    true" height="120" styleName="d1" sortableColumns="
    false" x="0" y="28" wordWrap="true" itemEditEnd="itemclick(event);" itemClick="editCell(event)">

    Probably your editCell is causing the edit session to end.

  • DataGrid alternating row colors per column

    Is there a way to set different alternating colors to each
    column in a DataGrid. I have a datagrid where I want two of the
    columns to have different alternating row colors, one column (red
    and light red) and the other (green and light green).
    Many thanks

    You can simply set the DataGridColumn property to the
    approprate colors.
    ex.
    <mx:DataGrid y="0" x="0" width="100%">
    <mx:columns>
    <mx:DataGridColumn id="col1" backgroundColor="0x640000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0xFF0000"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x006600"
    dataField="col1"/>
    <mx:DataGridColumn id="col1" backgroundColor="0x33CC33"
    dataField="col1"/>
    </mx:columns>
    </mx:DataGrid>
    or you can use the setStyle:
    col1.setStyle("backgroudColor", 0x640000)

Maybe you are looking for

  • How do I reformat my external hard drive from fat32 to HFS??

    I have an iomega hdd 160gb hard drive and need to move files larger than 4gb to my external hard drive. Hard drive is currently formatted to fat32. How in the world can I reformat this drive to the mac friendly hfs so that I can backup my files?? Any

  • How can i disable iTunes match on my new iPod?

    I want all my music locally stored on my new iPod touch. I want this so that I do not have to rely on wifi to have access to my music, and so that sonos will work with it.

  • Problem in the Build Script Running

    Hi Friends I am facing a issue while running build script for which i need your help. I am using RAD 7.0 as the development and using WebSphere Application Server 6.1 as the runtime. I have my source folder path as follows. E:\RT\RI complete\buildscr

  • How u guys build query in program

    Hey guys, i was wondering how u guys build queries in the program. i mean if you use String or StringBuffer. e.g. SELECT * FROM MY_TABLE WHERE X=someValue and Y=someValue and Z= someValue. if i use String i have to use + operator to get the values at

  • How to send mail from adobe interactive form without opening the outlook

    Hello all, When the end user press the submit button i want it to send the XML data without opening the outlook or other mail application. Is there a way to do this? I tried javascript codes to send mail with UI = false but it did not work. Thank you