Skip to Content

SetValue in dropdownbox

Hi,

I have a dropdownbox.

r1c1 is a dropdownbox.

oJSONModel1.loadData(sUrlSlots, null, false);

r1c1.setModel(oJSONModel1);

var oItemTemplateDate = new sap.ui.core.ListItem({

text : {

path : "SlotDt",

formatter : function(fValue) {

jQuery.sap.require("sap.ui.core.format.DateFormat");

var oDateFormat = sap.ui.core.format.DateFormat.getDateTimeInstance({

pattern : "YYYY-MM-dd"

});

if (fValue != undefined || fValue != null) {

fValue = fValue.toString();

fValue = fValue.slice(6, -2);

fValue = Number(fValue);

}

return oDateFormat.format(new Date(fValue));

}

}

});

oItemTemplateDate.bindProperty("enabled", "enabled");

r1c1.bindItems("/d/results", oItemTemplateDate);

}

I am trying to set default value from a list

r1c1.setValue(oFreightOrder.ZZSLOT_DT);

But its not working. Any hint how to resolve this issue.

Best regards,

Rohit

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jan 06, 2015 at 02:08 PM

    The value you are trying to set, does it have the same format as the formatted value of your listitem template?

    Add a comment
    10|10000 characters needed characters exceeded

    • Are there no errors in the console?

      Is oFreightOrder.ZZSLOT_DT really a string value in format "YYYY-MM-dd"?

      Does that value also exists in your dropdown?

      Are you sure the 'setValue' method is being called?

      If so, then I don't see any reason why it shouldn't work... Therefore, it must be anything from the above

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.