I took Martins approach and changed it a little. Now you can:
(a) use the pixel unit ( myidname_setWidth_200px)
(b) remove the width property of a panel (myidname_none)
(c) use "percent" as default unit (myidname_setWidth_30 OR myidname_setWidth_30_percent)
(d) fill up the remaining space of fixed panels (panel1_setWidth_300px and panel2_setWidth_fill_300)
require(['jquery', 'splunkjs/mvc/simplexml/ready!'], function($) {
$("[id*=setWidth]").each(function() {
var match = /setWidth_(\d+)?(_)?(percent|px|pixel|none|fill)?(_)?(\d+)?(_)?(left|right)?/.exec($(this).attr('id'));
console.log("matches\nmatch 1: "+match[1]+"\nmatch 2: "+match[2]+"\nmatch 3:"+match[3]+"\n");
if (match[1]) {
if (match[3] == 'percent' || match[3] == '') {
$(this).closest(".dashboard-cell").css('width', match[1]+'%');
}
else if (match[3] == 'px' || match[3] == 'pixel') {
$(this).closest(".dashboard-cell").css('width', match[1]+'px');
}
}
else if (match[3] == 'none') {
$(this).closest(".dashboard-cell").css('width', '');
}
else if (match[3] == 'fill') {
if (match[5]) {
$(this).closest(".dashboard-cell").css('width', 'calc(100% - '+match[5]+'px)');
}
}
});
$(window).trigger('resize');
});
... View more