Skip to content

Commit

Permalink
Devextreme SortIterVar Override
Browse files Browse the repository at this point in the history
  • Loading branch information
coronabytes committed Sep 14, 2023
1 parent a08d06b commit 594a39e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Core.Arango.DevExtreme/ArangoTransform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,26 +481,26 @@ private string Sort()
if (_loadOption.Sort != null)
sortingInfos.AddRange(_loadOption.Sort.Where(x => x.Selector != null).ToList());
else
return _settings.StableSort ? $"SORT {_settings.IteratorVar}._key" : string.Empty;
return _settings.StableSort ? $"SORT {_settings.SortIteratorVar ?? _settings.IteratorVar}._key" : string.Empty;


var sort = "SORT " + string.Join(", ",
sortingInfos.Select(x =>
{
var prop = PropertyName(_settings.ValidPropertyName(x.Selector)
.FirstCharOfPropertiesToUpper());
.FirstCharOfPropertiesToUpper(), _settings.SortIteratorVar);
return $"{prop} {(x.Desc ? "DESC" : "ASC")}";
}));

if (_settings.StableSort && !sort.Contains("_key"))
sort += $", {_settings.IteratorVar}._key";
sort += $", {_settings.SortIteratorVar ?? _settings.IteratorVar}._key";

return sort;
}

bool IsCriteria(IList item) {
/*bool IsCriteria(IList item) {
return (item[0] is IList);
}
}*/


private string GetMatchingFilter(IList dxFilter, bool not = false)
Expand Down
5 changes: 5 additions & 0 deletions Core.Arango.DevExtreme/ArangoTransformSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public class ArangoTransformSettings
/// </summary>
public string IteratorVar { get; set; } = "x";

/// <summary>
/// SORT {SortIteratorVar}.{...} ASC
/// </summary>
public string SortIteratorVar { get; set; } = null;

/// <summary>
/// Name of primary key in client side model - default: key
/// </summary>
Expand Down

0 comments on commit 594a39e

Please sign in to comment.