Pages

August 04, 2012

How to update multiple rows at backend and refresh the UI?


Update multiple rows at backend and refresh the UI at the same time.


Hi friends,
           
              Some times we need to update multiple rows in grid (Form) and the same time need to refresh the user interface also. 
For example:-
In a form grid there is a check box that is for  xyzValue = Yes or No. all the selected records should be update when user press a button. In following image we are going to post all selected reords and at the same time we update all selected rows in back end as well as refresh the UI also.



    to do this write following code in your click method of post button.

void clicked()
{
    Ax_dataSource                                  _ Ax_dataSource  ;   // your data source Table
    ; 
    ttsbegin;
    while select forupdate   _ Ax_dataSource where   _ Ax_dataSource .Status == AllOpenPosted::Open
                                           &&   _ Ax_dataSource .checkBox == NoYes::Yes
    {
             // write here your required updation  after posting
          _ Ax_dataSource .Status    = AllOpenPosted::Posted;     
          _ Ax_dataSource .checkBox  = NoYes::No;                 
          _ Ax_dataSource .update();
        
    }
    ttscommit;
     Ax_dataSource _ds.refresh();        
     Ax_dataSource _ds .reread();
     Ax_dataSource _ds .research();
   super();
}

-Harry

No comments:

Post a Comment

Thanks