3

i used ui-select in angular-xeditable. in this sample all is ok but, Model not updated (foo.bar not change when select an item). can you help me?

<span editable-ui-select="foo.bar" e-ng-model="foo.bar" e-name="bar" name="bar" e-form="editableForm">
      {{foo.bar.name}}
      <editable-ui-select-match placeholder="Search..." style="width:500px">
        {{$select.selected.name}}
      </editable-ui-select-match>
      <editable-ui-select-choices repeat="b in bars | filter:$select.search">
        {{b.name}}
      </editable-ui-select-choices>
    </span>
ali
  • 83
  • 5
  • 1
    Are you sure that x-editable has implemented ui-select? I don't see it anywhere in the x-editable documentation – Beartums Nov 16 '15 at 09:18
  • thanx for your response, x-editable not implemented ui-select, but the sample has a directive for use ui-select in x-editable, all is ok, but only model not update when user selected an item. plase see the example. – ali Nov 16 '15 at 15:41
  • Have you found out the solution for this ? Thanks. – Sampath Feb 28 '16 at 09:50
  • no solution found :(( – ali Feb 29 '16 at 08:56
  • 1
    Hence are you using any alternative api for that ? Thanks. – Sampath Feb 29 '16 at 10:39

1 Answers1

0

I'm still testing, but After Many a cry and some prayers. The following modification works for me. got the idea from https://habrahabr.ru/post/277001/

ui-select support: https://github.com/vitalets/angular-xeditable/pull/300/files#diff-90635473805044e26bceb2f7ffecfa82

I've added 2 lines to the render function above code

this.inputEl.attr('on-select', 'fooEvent($item)');
this.inputEl.attr('ng-model', '$parent.$data');

var dir = editableDirectiveFactory({ directiveName: 'editableUiSelect', inputTpl: '<ui-select></ui-select>', render: function () { this.parent.render.call(this); this.inputEl.append(rename('ui-select-match', match)); this.inputEl.append(rename('ui-select-choices', choices)); this.inputEl.attr('on-select', 'fooEvent($item)'); this.inputEl.attr('ng-model', '$parent.$data'); } });

Otto
  • 56
  • 3