Skip to content

Commit 184bc98

Browse files
fixed bug in sorting window
1 parent 9d109e1 commit 184bc98

4 files changed

Lines changed: 23 additions & 20 deletions

File tree

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mvcct-controls",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"homepage": "https://github.com/MvcControlsToolkit/mvcct-controls",
55
"description": "core javascript files for Mvc Controls Toolkit controls",
66
"main": [

modules/mvcct.controls.query.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
function prepareFilter(form)
8383
{
8484
//collects information
85-
fieldsIndex={};
85+
var fieldsIndex={};
8686
[].filter.call(form.elements, function (el) {
8787
return (el.type != "radio" && el.type != 'button'
8888
&& el.type != 'reset' && el.type != 'submit' && el.tagName != 'BUTTON') || el.checked;
@@ -215,7 +215,7 @@
215215
}
216216
function prepareSorting(form)
217217
{
218-
fieldsIndex={};
218+
var fieldsIndex=[];
219219
[].filter.call(form.elements, function (el) {
220220
return (el.type != "radio" && el.type != "checkbox" && el.type != 'button'
221221
&& el.type != 'reset' && el.type != 'submit' && el.tagName != 'BUTTON') || el.checked;
@@ -232,17 +232,20 @@
232232
isType=true;
233233
index = el.name.substr(13);
234234
}
235+
index=parseInt(index);
235236
var clause = fieldsIndex[index];
236237
if(!clause) fieldsIndex[index] = clause = {};
237238
if(isType) clause['down'] = el.value == 'desc';
238239
else clause['property'] = el.value;
239240
});
240241
var res = [];
241-
for (var index in fieldsIndex) {
242-
if (fieldsIndex.hasOwnProperty(index)) {
242+
var duplicates = {};
243+
for (var index=0; index<fieldsIndex.length; index++) {
243244
var clause = fieldsIndex[index];
244-
if(clause['property']) res.push(new odata['QuerySortingCondition'](clause));
245-
}
245+
if(!clause) continue;
246+
if(clause['property'] && !
247+
duplicates[clause['property']]) res.push(new odata['QuerySortingCondition'](clause));
248+
duplicates[clause['property']] = true;
246249
}
247250
if (res.length) return res;
248251
else return null;

modules/mvcct.controls.query.min.js

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mvcct-controls",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "core javascript files for Mvc Controls Toolkit controls",
55
"main": "mvcct.controls.min.js",
66
"repository": {

0 commit comments

Comments
 (0)