From: Archana Singh <archus(a)linux.vnet.ibm.com>
Added support to have converters
added as and when required in bootgrid
Signed-off-by: Archana Singh <archus(a)linux.vnet.ibm.com>
co-authored by: Pooja Kulkarni <pkulkark(a)linux.vnet.ibm.com>
---
ui/js/wok.bootgrid.js | 8 +++++---
ui/js/wok.user-log.js | 8 ++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/ui/js/wok.bootgrid.js b/ui/js/wok.bootgrid.js
index 1312fe5..c4082dd 100644
--- a/ui/js/wok.bootgrid.js
+++ b/ui/js/wok.bootgrid.js
@@ -23,6 +23,7 @@ wok.createBootgrid = function(opts) {
var fields = JSON.parse(opts['gridFields']);
var selection = ('selection' in opts) ? opts['selection'] : true;
var navigation = ('navigation' in opts) ? opts['navigation'] : 3;
+ var converters = ('converters' in opts) ? opts['converters'] :
'';
var gridMessage = ('loadingMessage' in opts &&
opts['loadingMessage'].trim() && opts['loadingMessage'].length
> 0) ? opts['loadingMessage'] : i18n['WOKSETT0011M'];
var gridloadingHtml = ['<div id="' + gridId + '-loading"
class="wok-list-mask">',
@@ -49,7 +50,7 @@ wok.createBootgrid = function(opts) {
for (var i = 0; i < fields.length; i++) {
var columnHtml = [
- '<th data-type="', fields[i]["type"], '"
data-column-id="', fields[i]["column-id"], '"',
(fields[i].identifier) ? 'data-identifier="true"' : '',
("header-class" in fields[i]) ? 'data-header-css-class="gridHeader
' + fields[i]["header-class"] + '"' : 'gridHeader',
("data-class" in fields[i]) ? ' data-align="' +
fields[i]["data-class"] + '"' + '
headerAlign="center"' : ' data-align="left"
headerAlign="center"', ("formatter" in fields[i]) ?
'data-formatter=' + fields[i]["formatter"] : '',
(fields[i].width) ? (' data-width="' + fields[i].width + '"') :
'',
+ '<th data-type="', fields[i]["type"], '"
data-column-id="', fields[i]["column-id"], '"',
(fields[i].identifier) ? 'data-identifier="true"' : '',
("header-class" in fields[i]) ? 'data-header-css-class="gridHeader
' + fields[i]["header-class"] + '"' : 'gridHeader',
("data-class" in fields[i]) ? ' data-align="' +
fields[i]["data-class"] + '"' + '
headerAlign="center"' : ' data-align="left"
headerAlign="center"', ("formatter" in fields[i]) ?
'data-formatter=' + fields[i]["formatter"] : '',
(fields[i].width) ? (' data-width="' + fields[i].width + '"') :
'', ("converter" in fields[i]) ? 'data-converter=' +
fields[i]["converter"] : '',
'>', ("title" in fields[i]) ? fields[i]["title"] :
fields[i]["column-id"],
'</th>'
].join('');
@@ -72,8 +73,9 @@ wok.createBootgrid = function(opts) {
},
"settings-user-log-message": function(column, row) {
return '<span class="trim" data-toggle="tooltip"
data-placement="auto bottom" title="'+row.message+'">'
+row.message+ '</span> ';
- }
+ },
},
+ converters: converters,
css: {
iconDown: "fa fa-sort-desc",
iconUp: "fa fa-sort-asc",
@@ -138,4 +140,4 @@ wok.showBootgridData = function(opts) {
wok.hideBootgridData = function(opts) {
$("#" + opts['gridId'] + " tbody").hide();
-};
\ No newline at end of file
+};
diff --git a/ui/js/wok.user-log.js b/ui/js/wok.user-log.js
index 8c2b4a7..ad90687 100644
--- a/ui/js/wok.user-log.js
+++ b/ui/js/wok.user-log.js
@@ -88,13 +88,12 @@ wok.listUserLogConfig = function() {
"title": i18n['WOKSETT0003M']
}, {
"column-id": 'date',
- "formatter": "settings-user-log-date",
- "converter": 'string',
+ "converter": 'date-locale-converter',
"order": 'desc',
"title": i18n['WOKSETT0004M']
}, {
"column-id": 'time',
- "converter": 'string',
+ "converter": 'time-locale-converter',
"order": 'desc',
"title": i18n['WOKSETT0005M']
},
@@ -109,6 +108,7 @@ wok.listUserLogConfig = function() {
];
wok.opts_user_log['gridFields'] = JSON.stringify(gridFields);
+ wok.opts_user_log['converters'] = wok.dateTimeLocaleConverters;
ulGrid = wok.createBootgrid(wok.opts_user_log);
wok.hideBootgridLoading(wok.opts_user_log);
@@ -243,4 +243,4 @@ wok.initUserLogWindow = function() {
});
$('#form-advanced-search').submit();
});
-};
\ No newline at end of file
+};
--
1.8.3.1