Skip to content

Commit

Permalink
Fix a bug where the actual collection was replaced rather to update i…
Browse files Browse the repository at this point in the history
…ts own items
  • Loading branch information
Fitzchak Yitzchak committed Nov 20, 2011
1 parent 2b90905 commit cabc751
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions Raven.Studio/Models/QueryModel.cs
Expand Up @@ -100,14 +100,6 @@ private set
public BindableCollection<string> SortBy { get; private set; }
public BindableCollection<string> SortByOptions { get; private set; }

private void SortByCtor()
{
SortBy = new BindableCollection<string>(x => x);
SortByOptions = new BindableCollection<string>(x => x);

SortBy.CollectionChanged += (sender, args) => SortByOptions.Match(SortByOptions.Except(SortBy).ToList());
}

public ICommand AddSortBy
{
get { return new ChangeFieldValueCommand<QueryModel>(this, x => x.SortBy.Add(SortByOptions.First())); }
Expand Down Expand Up @@ -156,7 +148,10 @@ public QueryModel()

DocumentsResult = new Observable<DocumentsModel>();
Query = new Observable<string>();
SortByCtor();

SortBy = new BindableCollection<string>(x => x);
SortByOptions = new BindableCollection<string>(x => x);
SortBy.CollectionChanged += (sender, args) => SortByOptions.Match(SortByOptions.Except(SortBy).ToList());

Query.PropertyChanged += GetTermsForUsedFields;
CompletionProvider = new Observable<ICompletionProvider>();
Expand All @@ -179,7 +174,7 @@ public override void LoadModelParameters(string parameters)
}
fields.Match(definition.Fields);
IsSpatialQuerySupported = definition.Map.Contains("SpatialIndex.Generate");
SortByOptions = fields;
SortByOptions.Match(fields);
}).Catch();
}

Expand Down

0 comments on commit cabc751

Please sign in to comment.