Skip to content

Commit

Permalink
fixed bug in sorting window
Browse files Browse the repository at this point in the history
  • Loading branch information
frankabbruzzese committed Jun 19, 2017
1 parent 9d109e1 commit 184bc98
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 20 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mvcct-controls",
"version": "1.0.5",
"version": "1.0.6",
"homepage": "https://github.com/MvcControlsToolkit/mvcct-controls",
"description": "core javascript files for Mvc Controls Toolkit controls",
"main": [
Expand Down
15 changes: 9 additions & 6 deletions modules/mvcct.controls.query.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
function prepareFilter(form)
{
//collects information
fieldsIndex={};
var fieldsIndex={};
[].filter.call(form.elements, function (el) {
return (el.type != "radio" && el.type != 'button'
&& el.type != 'reset' && el.type != 'submit' && el.tagName != 'BUTTON') || el.checked;
Expand Down Expand Up @@ -215,7 +215,7 @@
}
function prepareSorting(form)
{
fieldsIndex={};
var fieldsIndex=[];
[].filter.call(form.elements, function (el) {
return (el.type != "radio" && el.type != "checkbox" && el.type != 'button'
&& el.type != 'reset' && el.type != 'submit' && el.tagName != 'BUTTON') || el.checked;
Expand All @@ -232,17 +232,20 @@
isType=true;
index = el.name.substr(13);
}
index=parseInt(index);
var clause = fieldsIndex[index];
if(!clause) fieldsIndex[index] = clause = {};
if(isType) clause['down'] = el.value == 'desc';
else clause['property'] = el.value;
});
var res = [];
for (var index in fieldsIndex) {
if (fieldsIndex.hasOwnProperty(index)) {
var duplicates = {};
for (var index=0; index<fieldsIndex.length; index++) {
var clause = fieldsIndex[index];
if(clause['property']) res.push(new odata['QuerySortingCondition'](clause));
}
if(!clause) continue;
if(clause['property'] && !
duplicates[clause['property']]) res.push(new odata['QuerySortingCondition'](clause));
duplicates[clause['property']] = true;
}
if (res.length) return res;
else return null;
Expand Down
24 changes: 12 additions & 12 deletions modules/mvcct.controls.query.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mvcct-controls",
"version": "1.0.5",
"version": "1.0.6",
"description": "core javascript files for Mvc Controls Toolkit controls",
"main": "mvcct.controls.min.js",
"repository": {
Expand Down

0 comments on commit 184bc98

Please sign in to comment.