Smart-select on change event

Hello,

I have following issues with smart-select

  1. I have used “pushState: true” while app initialization and the smart-select with data-open-in=“page”. smart select does not updates history. i.e. when an option is selcted, and if the smart-select is used at main page, the app exists. The problem is not observed when I use data-open-in=“popup”

  2. select on change event is not received. FYI, I add options dynamically on pageInit.

  3. “store-data” does not work if options are added dynamically. It works well for static options.

Please help resolve. I am using Framework7 v1.6.5

Best Regards,
Suresh

point 2 is not solved. I changed my code from

$$(“select[name=‘city’]”).on(‘change’, function(e){
city=$$(this).val();
name = $$(this).attr(“name”);
console.log("Selected city : " + city + ", name : " + name);
});

to

$$(document.body).on(‘change’, “select[name=‘city’]”, function(e){
city=$$(this).val();
name = $$(this).attr(“name”);
console.log("Selected city : " + city + ", name : " + name);
});

points 1 and 3 are still unresolved.

1 Like
  1. When does it happen? Do you press hardware Back button or select a value?

  2. It’s correct. Store-data stores selected index value, not select’s options array. So if you do filling smart-select from 3d party resource, make a storing implementation too.

Thanks @adasoft for your response.

  1. Yes I use hardware back button on android. and I have used data-back-on-select=“true” too

  2. Yes, I expect the same. For static options, the index is stored, but for dynamic options, index is not stored. Is it correct behavior ?

Many Thanks.