|
|
@@ -379,8 +379,13 @@
|
|
|
$this_ = this.$header.find('th').eq($this.index());
|
|
|
|
|
|
this.$header.add(this.$header_).find('span.order').remove();
|
|
|
- this.options.sortName = $this.data('field');
|
|
|
- this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
|
|
|
+
|
|
|
+ if (this.options.sortName === $this.data('field')) {
|
|
|
+ this.options.sortOrder = this.options.sortOrder === 'asc' ? 'desc' : 'asc';
|
|
|
+ } else {
|
|
|
+ this.options.sortName = $this.data('field');
|
|
|
+ this.options.sortOrder = $this.data('order') === 'asc' ? 'desc' : 'asc';
|
|
|
+ }
|
|
|
this.trigger('sort', this.options.sortName, this.options.sortOrder);
|
|
|
|
|
|
$this.add($this_).data('order', this.options.sortOrder)
|