2 Replies Latest reply on Sep 29, 2011 12:37 AM by Venkatesan Balasubramanian

    how to add same name records from datagrid,while i am selecting one of the record and click add butt

    Venkatesan Balasubramanian Level 1

      hi  friends,

       

       

       

       

      i  am doing flex 4 mxml web application with as3,i am struck up in the following  concept,shar your suggession about this.

       

      i am using datagrid with 3 columns NUMBER, NAME, AMOUNT. one text box and one add button and one delete button.

       

      i have two records in the same name in grid, when i click one record from the grid and click ADD button means that time ,both records  AMOUNT WILL ADDED   which record having the same name and give that value in a text box.

       

       

      how to do this?

       

      any useful suggesssion or modal sample

       

      Thanks in advance,

      B.venkatesan.

        • 1. Re: how to add same name records from datagrid,while i am selecting one of the record and click add butt
          gajanan hiroji

          hello,

           

           

          var totalsum:int=0;

          var index:int=db.selectedindex;

          var selname:string =bd.dataprovide.getItemAt(index).name;

           

          var totallen:int=(db.dataprovider).length;

           

          for(var i:int=0;i<totallen;i++)

          {

              var  checkduplicate:string=bd.dataprovide.getItemAt(i).name;

             if(checkduplicate==selname)

          {

              totalsum+=bd.dataprovide.getItemAt(i).AMOUNT;

          }

          }

           

          textfield_id.text=totalsum

           

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

                               Gajanan Hiroji | hgajanan@isacweb.com | www.isacglobal.com

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

          • 2. Re: how to add same name records from datagrid,while i am selecting one of the record and click add butt
            Venkatesan Balasubramanian Level 1

            hi gajanan hiroji,

             

            Thanks for the useful help.

             

            And one more think i want ask you, i am doing web application, i am using 5 modules in that,every module in a single page.

             

            In this application i am using datagrid in last 3 models. the operation is same for the models, select a record from grid then click post it should move to next page.

            In that i am writting init() function . this for showing the last module posted records here while i am entering this model.

            At the panel initializing time the records loading and showing in the gird,

             

            i written refresh function for this .

             

            But some times the function working properly and show the records in grid.

            some time it wont show the records.

             

            refresh function not working properly..

             

             

            looking for usful suggession,

             

             

            Thanks,

             

            B.venkatesan.