javascript - Sorting a JScript Array on a String Field with leading No.s -


i have js object, internal array of js object. internal onw like

function outerobj() {     this.items = new array();     this.clear = function () {         this.items = new array();     }     function __item(v1, v2, v3, v4) {         this.val_1 = v1;         this.val_2 = v2;         this.val_3 = v3;         this.val_4 = v4;     }     this.add = function (va, vb, vc, vd) {         this.items.push( new __item(va, vb, vc, vd) );     }     ... } 

the array loaded through spservices getlistitems() call, using .each( . . . ) on resultant xml. results ordered (<orderby>), results common irritation:

1 10 11 2 21 3 42a 42b 

i cannot away inclusion of letters (this name of real-world items), while want sort be

1 2 3 10 11 21 42a 42b 

suggestions?

just use javascript array.sort()

code this:

this.items.sort() 

heres link: javascript sort reference


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -