[v2] How can I render Smart Select value?


#1

I have this question:
I need display selected value by HTML string,but Framework7’s method setValue only support text.
so i add the render code in the close event, it works well when selected value changes, but it didn’t work on SmartSelect init evnet,
How can I render smart select value?

var smartSelect = app.smartSelect.create({
  el:"#sendTypeSmartSelect",
  openIn: “popover”,
  valueEl: “#sendTypeLabel”,
  closeOnSelect: true,
  routableModals: false,
  on: {
   “close”: function() {
      // type:typeValue
     var text = $$(this.valueEl).text() || “:”;
     var values = text.split(":");
     var html = “<small>” + values[0] + “:</small><small class='text-color-orange'>” + values[1] + “</small>”;
      $$(this.valueEl).html(html);
   },
  }
});


#2

Hi, maybe you can use a page event to render your html value.
Like, page:beforein event.