Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4359

mesh header sorting style out of sync

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Normal Normal
    • 8.6.3
    • 8.5.2.1, 8.6.2
    • Components
    • Security Level: Jimmy
    • ZK 8.6.3 S1

      Steps to Reproduce

      run the attachment toggle-column-sorting.zul

      click the buttons to toggle column sorting for column 1 and 2

      Current Result

      initially the columns are rendered correctly

      click col1 disable sort -> col1 keeps the css class z-column-sort
      click col1 enable sort -> col1 is marked as sorted 'ascending' (even if order is still 'natural')

      click col2 enable sort -> col2 doesn't get the class z-column-sort, instead the icon gets both classes z-icon-caret-up z-icon-caret-down making it look like 'ascending'

      Expected Result

      column and sorticon classes reflect the actual state of the component

      Debug Info

      the example uses a background color to highlight columns with class .z-column-sort

      Root Cause

      Workaround

      enable the commented script in the attachment:

          zk.afterLoad('zul.mesh', function() {
          	var xSortWidget = {};
          	zk.override(zul.mesh.SortWidget.prototype, xSortWidget, {
          		setSortAscending : function(type) {
          			xSortWidget.setSortAscending.apply(this, arguments);
          			this.syncSortingStyles();
          		},
          		setSortDescending : function(type) {
          			xSortWidget.setSortDescending.apply(this, arguments);
          			this.syncSortingStyles();
          		},
          		syncSortingStyles: function() {
          		    if(this.desktop) {
                          jq(this).toggleClass(this.$s('sort'), this.isSortable_());
                              if(this.isSortable_()) {
                                  var sortDir = this.getSortDirection();
                                  this._sortDirection = null;
                                  this.setSortDirection(sortDir);
                              }
          		    }
          		}
          	});//zk.override
          });//zk.afterLoad
      

            DevChu DevChu
            cor3000 cor3000
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: