OpenUI – Single Click Sort

Got triggered by an internal discussion with some colleagues, to re-enable a single-click-sort solution. Came up with the below solution, which does work beautifully.

But with to major drawbacks:

  1. It disallows the column ‘lock’ / ‘unlock’ feature.
  2. It still sorts default in Ascending mode, where I’d like to have the option to specificy ‘Descending’ under certain circumstances.

Well – thought, just post the work-in-progress and elicit some feedback from the field (yes, you!). Posted the same sample code also on the OracleSiebel Git repository.

My first focus is on a proper solution that will somehow enable lock/unlock along side the single-click-sort. The path using a dblclick event handler led nowhere, because having two mouse events on the same element is simply no good. I had a quick look at overriding the context menu (right mouse) and instead displaying again the standard sort / lock popup.

Any takers :-)?

if (typeof(SiebelAppFacade.QuickSortPR) === "undefined") {

SiebelJS.Namespace("SiebelAppFacade.QuickSortPR");
define("siebel/custom/QuickSortPR", ["siebel/jqgridrenderer"],
function () {
SiebelAppFacade.QuickSortPR = (function () {

function QuickSortPR(pm) {
SiebelAppFacade.QuickSortPR.superclass.constructor.apply(this, arguments);
}

SiebelJS.Extend(QuickSortPR, SiebelAppFacade.JQGridRenderer);

QuickSortPR.prototype.ShowUI = function () {
SiebelAppFacade.QuickSortPR.superclass.ShowUI.apply(this, arguments);

var placeHolder = "s_" + this.GetPM().Get("GetFullId") + "_div";
var elSortable = $("#" + placeHolder).find(".ui-jqgrid-sortable");
var sort = $("li[data-caption='Sort']");

elSortable.on("click", function () {

sort.parent().css("visibility", "hidden");
setTimeout(function () {
sort.click();
}, 0);
});
}

return QuickSortPR;
}());
return "SiebelAppFacade.QuickSortPR";
})
}

– Jeroen

Advertisements

One thought on “OpenUI – Single Click Sort

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s