Skip to content

Commit

Permalink
added Typeahead LimitTo config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendy committed May 26, 2014
1 parent 9af1ad7 commit 3ab6feb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ internal class SqlTypeaheadListPickerPreValueEditor : PreValueEditor
[PreValueField("customLabel", "Label Macro", EmbeddedResource.RootUrl + "CustomLabel/CustomLabelConfig.html", HideLabel = true)]
public string CustomLabel { get; set; }

// TODO: TypeaheadList config
[PreValueField("typeaheadListPicker", "", EmbeddedResource.RootUrl + "TypeaheadListPicker/TypeaheadListPickerConfig.html", HideLabel = true)]
public string TypeaheadListPicker { get; set; }

[PreValueField("listPicker", "", EmbeddedResource.RootUrl + "ListPicker/ListPickerConfig.html", HideLabel = true)]
public string ListPicker { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ internal class XmlTypeaheadListPickerPreValueEditor : PreValueEditor
[PreValueField("customLabel", "Label Macro", EmbeddedResource.RootUrl + "CustomLabel/CustomLabelConfig.html", HideLabel = true)]
public string CustomLabel { get; set; }

// TODO: TypeaheadList config
[PreValueField("typeaheadListPicker", "", EmbeddedResource.RootUrl + "TypeaheadListPicker/TypeaheadListPickerConfig.html", HideLabel = true)]
public string TypeaheadListPicker { get; set; }

[PreValueField("listPicker", "", EmbeddedResource.RootUrl + "ListPicker/ListPickerConfig.html", HideLabel = true)]
public string ListPicker { get; set; }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<div class="nuComponents-config">

<div>

<label for="">
Limit To
<small>limit the number of selectable choices - 0 mean no limit</small>
</label>

<div>

<input type="number"
ng-model="model.value.limitTo"
ng-init="model.value.limitTo = model.value.limitTo || 0" />

</div>
</div>

</div>

Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ angular

});

// setup watch on selected options
$scope.$watchCollection('selectableOptions', function () {
// TODO: limit to number of choices specified in config
});
if ($scope.model.config.typeaheadListPicker.limitTo > 0) {
$scope.$watchCollection('selectableOptions', function () {
$scope.selectableOptions = $scope.selectableOptions.slice(0, $scope.model.config.typeaheadListPicker.limitTo);
});
}

}]);

3 changes: 3 additions & 0 deletions source/nuComponents.DataTypes/nuComponents.DataTypes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,9 @@
<ItemGroup>
<EmbeddedResource Include="Shared\ListPicker\ListPickerPartial.html" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Shared\TypeaheadListPicker\TypeaheadListPickerConfig.html" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
Expand Down

0 comments on commit 3ab6feb

Please sign in to comment.