remotes/origin/setup
ArturBaybulatov 10 years ago
parent dab6f0f0e2
commit fac59e35ae
  1. 47
      assets/index.js

@ -49,28 +49,38 @@ $(function() {
var $specSelect3 = $('.-spec-select-level-3')
var $specSelect4 = $('.-spec-select-level-4')
//$specSelect1.on('select2:select', function($evt) {
//
//})
$specSelect1.on('select2:select', function($evt) {
//var spec = $evt.params.data.orig_item
//console.log('Select 1 changed:', spec)
console.log('Select 1 changed')
})
$specSelect2.on('select2:select', function($evt) {
var spec = $evt.params.data.orig_item
$specSelect1.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select')
//console.log('Select 2 changed:', spec)
console.log('Select 2 changed')
$specSelect1.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>')
$specSelect1.trigger('select2:select')
})
$specSelect3.on('select2:select', function($evt) {
var spec = $evt.params.data.orig_item
$specSelect2.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select')
$specSelect1.trigger('select2:select')
//console.log('Select 3 changed:', spec)
console.log('Select 3 changed')
$specSelect2.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>')
$specSelect2.trigger('select2:select')
})
$specSelect4.on('select2:select', function($evt) {
var spec = $evt.params.data.orig_item
$specSelect3.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>').trigger('select2:select')
$specSelect2.trigger('select2:select')
//console.log('Select 4 changed:', spec)
console.log('Select 4 changed')
$specSelect3.append('<option value="'+ spec.parent.id + '">' + spec.parent.name + '</option>')
$specSelect3.trigger('select2:select')
})
window.$specSelect1 = $specSelect1
@ -80,6 +90,27 @@ $(function() {
})
//function select2_search ($el, term) {
// $el.select2('open');
//
// // Get the search box within the dropdown or the selection
// // Dropdown = single, Selection = multiple
// var $search = $specSelect1.data('select2').dropdown.$search.val('b')
// // This is undocumented and may change in the future
//
// $search.val(term);
// $search.trigger('keyup');
//}
//$('button').on('click', function () {
// var $select = $($(this).data('target'));
// select2_search($select, 'Arizona');
//});
// Utils -----------------------------------------------

Loading…
Cancel
Save