Commit 2f4bdefc authored by Alfredo Sumaran's avatar Alfredo Sumaran

Allow to pass non-asynchronous data to GitLabDropdown

parent 8048d611
...@@ -83,15 +83,19 @@ class GitLabDropdown ...@@ -83,15 +83,19 @@ class GitLabDropdown
search_fields = if @options.search then @options.search.fields else []; search_fields = if @options.search then @options.search.fields else [];
if @options.data if @options.data
# Remote data # If data is an array
@remote = new GitLabDropdownRemote @options.data, { if _.isArray @options.data
dataType: @options.dataType, @parseData @options.data
beforeSend: @toggleLoading.bind(@) else
success: (data) => # Remote data
@fullData = data @remote = new GitLabDropdownRemote @options.data, {
dataType: @options.dataType,
beforeSend: @toggleLoading.bind(@)
success: (data) =>
@fullData = data
@parseData @fullData @parseData @fullData
} }
# Init filiterable # Init filiterable
if @options.filterable if @options.filterable
...@@ -204,7 +208,12 @@ class GitLabDropdown ...@@ -204,7 +208,12 @@ class GitLabDropdown
else else
selected = if @options.isSelected then @options.isSelected(data) else false selected = if @options.isSelected then @options.isSelected(data) else false
url = if @options.url then @options.url(data) else "#" url = if @options.url then @options.url(data) else "#"
text = if @options.text then @options.text(data) else ""
if @options.text?
text = @options.text(data)
else
text = data.text if data.text?
cssClass = ""; cssClass = "";
if selected if selected
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment