Skip to Content
0

Issue in Tokens while applying it to MultiInput

Sep 03, 2017 at 11:39 AM

36

avatar image

Hi.

I have Multi Input where I am applying tokens to the control. So tokens have key and text properties. Previously I used key as integer and text as user input. The MutiInput tokens can change based user selection. I am storing tokens in model and applying it when user navigates to the same multiinput. Here the duplicate id error occuring. I replaced key value as User text value. But still I am getting the duplicate error. Have anyone came across this situation?

Code:

var sFrenchToken = mId.getTokens();

var getKey = sFrenchToken.getProperty("key");

var getTxt = sFrenchToken.getProperty("text");

var arr = [];

arr.push({ text: getTxt, key: getTxt});

var oModelEn = new sap.ui.model.json.JSONModel(arr);

<MultiInput id="mId" tokens="{oModelEn>/}">

<tokens> <Token key="{oModelEn>key}" text="{oModelEn>text}"/> </tokens> </MultiInput>

Error : adding element with duplicate id '__token0-__xmlview3--"id of my control"-0'

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

avatar image
Former Member
Sep 03, 2017 at 12:48 PM
0

Hi,

Looks like you are trying to get the tokens from the control, take the data from them, and then bind the data to the same control again.

Why not use only one approach? Either bind and get the data from the model or use the control methods to get / add tokens.

Share
10 |10000 characters needed characters left characters exceeded
Ravi kiran R Sep 04, 2017 at 07:40 AM
0

Hi Karthik,

I would suggest you to do the way as Yogesh said.

Though i didn't get id error, i could see the code broke at the second line.

You may replace with,

var getKey = sFrenchToken[0].getProperty("key");

var getTxt = sFrenchToken[0].getProperty("text");

Regards,

Ravikiran

Share
10 |10000 characters needed characters left characters exceeded