cancel
Showing results for 
Search instead for 
Did you mean: 

descriptionAndId in not Edit Mode - Smartfield

smarchesini
Active Contributor
0 Kudos

Hello everyone,
is there a possibility to have in not edit mode the description of entry?

I bind the smartfiled with CDS between HANA and Gateway (with segw /t) and annotation of value help. In XML I added the standard code and property to show that description and id:

<smartField:SmartField id="Country" value="{Country}" showLabel="false" visible="true" editable="true" textInEditModeSource="NavigationProperty" change="onChangeFieldCountry" width="50%">
       <smartField:configuration>
	      <smartField:Configuration displayBehaviour="descriptionAndId"/>
     </smartField:configuration>
</smartField:SmartField>


Can you help me with this?

Sebastiano

afordham
Participant
0 Kudos

Hi Sebastian,

I am facing the reverse problem: I can get the description appearing for the read only field but not for the editable field. How did you generate the com.sap.vocabularies.Common.v1.Text annotation needed to specify the path to the CDS text view?

Thanks, Andrew

Accepted Solutions (1)

Accepted Solutions (1)

smarchesini
Active Contributor

Hi Mahesh,
I'm solving that issue with expand the binding of CDS.
In my Virtual Model I create a MasterData consumption CDS and connect with assotiation the subcds with text and id of country.

The Country CDS have annotations and when I expand the MasterData than take all the proprerty of sub cds.
The code is bellow :

...CDS COUNSUMPTION..<br>
@ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
    _itemdata._country,

....CDS INTERFACE...<br>//there are another cds for all the masterdata (itemdata)
<br>...CDS COUNTRY BASICS......
define view ZCDS_COUNTRY_LS
as select from zppm_country_tab  as country
association [1..*] to ZCDS_COUNTRY_TX as _country_t on $projection.country = _country_t.country 
                                                  and _country_t.lang = $session.system_language {

    @EndUserText.label: 'Country'
    @Search.defaultSearchElement: true
    @ObjectModel.text.association: '_country_t'
    @Search.ranking: #HIGH
    key country.country as country,
    
    @EndUserText.label: 'Geographical Area'
    country.geo_area as geoarea, 
    
    // Associations
    @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
    _country_t
    
}

....Controller Javascript....

this.getView().bindElement({
		path: masterdataPath,
		parameters: {
		      expand: "to_country,to_mktown,to_region,to_resurse,to_itemdata"
		}
});

Anyway thanks for your help 😉

maheshpalavalli
Active Contributor

Thanks Sebastian for sharing the information! 🙂

Just a question.. Earlier in both edit and non edit mode you were getting only the ID but now you are getting both id and text in both the modes right?

BR,

Mahesh

smarchesini
Active Contributor

Hi maheshkumar.palavalli ,

yes. With the smartfield configuration I can see both (id and description) in both of the modality 😉

<smartField:configuration>
	      <smartField:Configuration displayBehaviour="descriptionAndId"/>
     </smartField:configuration>

Answers (2)

Answers (2)

shashank0
Explorer
0 Kudos

Finally an answer !!

Thank you.

maheshpalavalli
Active Contributor
0 Kudos

Have you tried display behaviour as auto?

I think the best way would be to display the id and description in display mode and in the edit mode, show only the ID. I've seen couple of standard applications where it does the same.

Maybe you can change the display behaviors via binding, if it it edit mode then pass 'idOnly' to the displayBehaviour else pass descriptionAndId.

instead of idOnly you can also pass 'descriptionOnly' and check if it works.. but like i said standard only shows id in the edit mode.

BR,

Mahesh

smarchesini
Active Contributor
0 Kudos

Thanks Mahesh,

Just a question.. Earlier in both edit and non edit mode you were getting only the ID but now you are getting both id and text in both the modes right?

Yep, I binding only the id of course. But with the "expand" and the displayBehaviour="descriptionAndId" i can see id and text in both mode

Sebastiano