2 Replies Latest reply on Aug 10, 2011 4:09 AM by Venkatesan Balasubramanian

    how to delete a selected row using a button outside from the datagrid in flex4 mxml application

    Venkatesan Balasubramanian Level 1

      hi friends,

       

      i am new to flex,i am using flex4 mxml application, i have doubt..please help.

       

       

      my requirement is i am using a data grid.i got data to this datagrid from another popup and saved the datagrid details also,now i want to delete a record from a data grid

       

       

      i am using one datagrid. one save button and delete button both buttons are placed outside the data grid. so once i click a row from data grid and click delete button means that record should delete from data grid.

       

       


      Any suggession and snippet codes are welcome.

       

       

      Thanks in Advance,

       

      B.Venkatesan

        • 1. Re: how to delete a selected row using a button outside from the datagrid in flex4 mxml application
          Vibhuti Gosavi(InfoCepts) Level 3

          Hi,

           

          This code can Help you :

           

          <?xml version="1.0" encoding="utf-8"?>

          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" viewSourceURL="srcview/index.html">

          <mx:Canvas width="472" height="359">

          <mx:DataGrid x="135" y="142" id="dgFee" dataProvider="{dp}" >

          <mx:columns>

           

          <mx:DataGridColumn dataField="amount" headerText="Amount" >

           

          </mx:DataGridColumn>

          </mx:columns>

          </mx:DataGrid>

           

          <mx:Script>

          <![CDATA[

          import mx.controls.CheckBox;

          import mx.collections.ArrayCollection;

          import mx.controls.Alert;

          public var dp:ArrayCollection = new ArrayCollection();

          public function addRow():void

          {

          var tmp:Object = new Object();

          tmp['amount'] = 100;

          dp.addItem(tmp);

          }

          public function delRow():void

          {

          if(dgFee.selectedIndex != -1)

          dp.removeItemAt(dgFee.selectedIndex);

          }

           

           

          ]]>

          </mx:Script>

          <mx:Button x="147" y="72" label="AddRow" click="addRow()"/>

          <mx:Button x="256" y="68" label="DelRow" click="delRow()"/>

           

           

          </mx:Canvas>   

          </mx:Application>

           

          Thanks and Regards,

          -----------------------------------------------------------------------------------------

          Vibhuti Gosavi | vgosavi@infocepts.com | www.infocepts.com

          -----------------------------------------------------------------------------------------

          • 2. how to save a selected row data from datagrid as save as pdf local system
            Venkatesan Balasubramanian Level 1

            First of all thanks a lot vibuthi,

             

             

            ok now i am need another help ;

             

            i am having one datagrid and one button outside the grid ,

             

            i am having one datagrid in that i am having 5 records if i click a record from the datagrid then click that button means that particular record will save as PDF in my local PC.

             

            How to do that,

             

            Any suggession or examples.

             

            Thanks in advance

             

            B.venkatesan.