-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sample for table cell coloring (#427)
* add sample for table cell coloring * cleanup
- Loading branch information
1 parent
460477e
commit 5b55b3b
Showing
3 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
CLASS z2ui5_cl_demo_app_305 DEFINITION | ||
PUBLIC | ||
CREATE PUBLIC . | ||
|
||
PUBLIC SECTION. | ||
|
||
INTERFACES if_serializable_object . | ||
INTERFACES z2ui5_if_app . | ||
|
||
TYPES: | ||
BEGIN OF ty_row, | ||
title TYPE string, | ||
value TYPE string, | ||
END OF ty_row . | ||
|
||
DATA: | ||
t_tab TYPE STANDARD TABLE OF ty_row WITH EMPTY KEY. | ||
|
||
PROTECTED SECTION. | ||
DATA client TYPE REF TO z2ui5_if_client. | ||
|
||
METHODS set_view. | ||
|
||
ENDCLASS. | ||
|
||
|
||
CLASS z2ui5_cl_demo_app_305 IMPLEMENTATION. | ||
|
||
METHOD set_view. | ||
|
||
DATA(view) = z2ui5_cl_xml_view=>factory( ). | ||
DATA(page) = view->shell( | ||
)->page( | ||
title = 'abap2UI5 - Tables and cell colors' | ||
navbuttonpress = client->_event( 'BACK' ) | ||
shownavbutton = abap_true ). | ||
|
||
page->_generic( | ||
name = `style` | ||
ns = `html` | ||
)->_cc_plain_xml( | ||
`td:has([data-color="red"]){ ` | ||
&& ` background-color: red;` | ||
&& `}` | ||
&& `` | ||
&& `td:has([data-color="green"]){` | ||
&& ` background-color: green;` | ||
&& `}` | ||
&& `` | ||
&& `td:has([data-color="blue"]){` | ||
&& ` background-color: blue;` | ||
&& `}` | ||
&& `` | ||
&& `td:has([data-color="orange"]){` | ||
&& ` background-color: orange;` | ||
&& `}` | ||
&& `` | ||
&& `td:has([data-color="grey"]){` | ||
&& ` background-color: grey;` | ||
&& `}` | ||
&& `` | ||
&& `td:has([data-color="yellow"]){` | ||
&& ` background-color: yellow;` | ||
&& `}` ). | ||
|
||
DATA(tab) = page->table( | ||
items = client->_bind_edit( t_tab ) | ||
mode = 'MultiSelect' | ||
)->header_toolbar( | ||
)->overflow_toolbar( | ||
)->title( 'change cell color' | ||
)->get_parent( )->get_parent( ). | ||
|
||
tab->columns( | ||
)->column( | ||
)->text( 'Title' )->get_parent( | ||
)->column( | ||
)->text( 'Color' )->get_parent( ). | ||
|
||
tab->items( )->column_list_item( | ||
)->cells( | ||
)->text( text = '{TITLE}' | ||
)->get( | ||
)->custom_data( | ||
)->core_custom_data( key = 'color' value = '{VALUE}' writetodom = abap_true | ||
)->get_parent( | ||
)->get_parent( | ||
)->input( value = '{VALUE}' enabled = abap_true ). | ||
|
||
client->view_display( view->stringify( ) ). | ||
|
||
ENDMETHOD. | ||
|
||
|
||
METHOD z2ui5_if_app~main. | ||
|
||
me->client = client. | ||
|
||
IF z2ui5_if_app~check_initialized = abap_false. | ||
t_tab = VALUE #( | ||
( title = 'entry 01' value = 'red' ) | ||
( title = 'entry 02' value = 'blue' ) | ||
( title = 'entry 03' value = 'green' ) | ||
( title = 'entry 04' value = 'yellow' ) | ||
( title = 'entry 05' value = 'orange' ) | ||
( title = 'entry 06' value = 'grey' ) ). | ||
|
||
set_view( ). | ||
ENDIF. | ||
|
||
CASE client->get( )-event. | ||
WHEN 'BACK'. | ||
client->nav_app_leave( ). | ||
ENDCASE. | ||
|
||
ENDMETHOD. | ||
ENDCLASS. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0"> | ||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"> | ||
<asx:values> | ||
<VSEOCLASS> | ||
<CLSNAME>Z2UI5_CL_DEMO_APP_305</CLSNAME> | ||
<LANGU>E</LANGU> | ||
<DESCRIPT>tab - editable</DESCRIPT> | ||
<STATE>1</STATE> | ||
<CLSCCINCL>X</CLSCCINCL> | ||
<FIXPT>X</FIXPT> | ||
<UNICODE>X</UNICODE> | ||
</VSEOCLASS> | ||
</asx:values> | ||
</asx:abap> | ||
</abapGit> |