CRM WEB UI 04 Detail Interface Add button

Source: Internet
Author: User

Well, this is a personal test play, slightly coquettish ... Please read it yourself.

1. Add the Global control attribute field to the Detail component controller:

2. Toolbar-related methods in the overview page, redefining get_buttons

  METHODif_bsp_wd_toolbar_callback~get_buttons. DATA: Lv_lockTYPEabap_bool VALUE abap_true, lv_enableTYPEAbap_bool VALUE Abap_false. DATA: lr_comTYPE REF  toZl_zlytest0_bspwdcompone3_impl. DATA: Rw_buttonTYPECrmt_thtmlb_button_ext. Pager METHODSuper->If_bsp_wd_toolbar_callback~get_buttons receiving Rt_buttons=rt_buttons. Lr_com?=ME-Comp_controller. CHECKLr_com isBOUND. IFLr_com->display =Abap_true. Lv_enable=Abap_false. ELSE. Lv_enable=Abap_true. ENDIF. Rw_button-TYPE= cl_thtmlb_util=>Gc_icon_save. Rw_button-on_click ='SAVE'. Rw_button-page_id =ME-component_id. Rw_button-enabled =lv_enable. APPENDRw_button tort_buttons. Rw_button-TYPE= cl_thtmlb_util=>Gc_icon_cancel. Rw_button-on_click ='CANCEL'. Rw_button-page_id =ME-component_id. Rw_button-enabled =lv_enable. APPENDRw_button tort_buttons. EndMethod.

3. Toolbar-related methods in the overview page, redefining get_number_of_visible_buttons

  METHOD if_bsp_wd_toolbar_callback~get_number_of_visible_buttons.     9 .   EndMethod.

The properties are defined in the implementation class of the 4.DETAIL view:

In 5.DETAIL view, redefine Do_prepare_output

    DATA: Ls_buttonTYPECrmt_thtmlb_button. Pager METHODSuper->Do_prepare_output. REFRESHGt_button. CLEAR: Ls_button. Ls_button-TYPE= cl_thtmlb_util=>Gc_icon_edit. Ls_button-TEXT= Cl_wd_utilities=>get_otr_text_by_alias ('Crm_uiu_bu/edit' ). Ls_button-enabled = Abap_true."This can be controlled here as appropriateLs_button-on_click ='EDIT'. APPENDLs_button toGt_button. EndMethod.

6. Modify Detail's HTM page: Control the configuration page with local variables

<% @page language="ABAP "%><% @extension name="thtmlb "prefix=" thtmlb "%><% @extension name="chtmlb "prefix=" chtmlb "%><% @extension name="BSP "prefix=" BSP "%><%data:lv_xml TypeSTRING, Lv_displaymode typeSTRING. Lv_displaymode= controller->view_group_context->Is_view_in_display_mode (CONTROLLER). %> <thtmlb:areaframesetter toolbarbuttons ="<%= Controller->gt_button%> "Maxbuttonnumber ="4 "DisplayMode ="<%= lv_displaymode%> "/><chtmlb:config mode ="RUNTIME "DisplayMode ="<%= controller->view_display%> "/>

7. Create an event handler for detail edit

  METHODEh_onedit. DATA: lr_comTYPE REF  toZl_zlytest0_bspwdcompone3_impl. Lr_com?=ME-Comp_controller. CHECKLr_com isBOUND. IFLr_com->display =Abap_true. Lr_com->display =Abap_false. View_display=Abap_false. ELSE. Lr_com->display =Abap_true. View_display=Abap_true. ENDIF. EndMethod.

Okay, OK.

CRM WEB UI 04 Detail Interface Add button

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.