diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index 7d8ec0622d0..1241ba7fe6c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -228,11 +228,11 @@ function resetPassword(uname) { * when a user type on the search field on User Listing page in * WSO2 MDM Console then click on the search button. */ -$("#search-btn").click(function () { - var searchQuery = $("#search-by-username").val(); - $("#ast-container").empty(); - loadUsers(searchQuery); -}); +//$("#search-btn").click(function () { +// var searchQuery = $("#search-by-username").val(); +// $("#ast-container").empty(); +// loadUsers(searchQuery); +//}); /** * Following function would execute @@ -248,94 +248,113 @@ function InitiateViewOption() { } } -function loadUsers(searchParam) { - - - $("#loading-content").show(); +function loadUsers() { + var loadingContentView = "#loading-content"; + $(loadingContentView).show(); - - var dataFilter = function(data){ + var dataFilter = function (data) { data = JSON.parse(data); var objects = []; - $(data.users).each(function( index ) { + $(data.users).each( function (index) { objects.push({ filter: data.users[index].username, - firstname: data.users[index].firstname ? data.users[index].firstname: '' , + firstname: data.users[index].firstname ? data.users[index].firstname : '' , lastname: data.users[index].lastname ? data.users[index].lastname : '', - emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '', - DT_RowId : "role-" + data.users[index].username}) + emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : '', + DT_RowId : "user-" + data.users[index].username}) }); - json = { + var json = { "recordsTotal": data.count, "recordsFiltered": data.count, "data": objects }; - return JSON.stringify( json ); - } + return JSON.stringify(json); + }; - var fnCreatedRow = function( nRow, aData, iDataIndex ) { + //noinspection JSUnusedLocalSymbols + var fnCreatedRow = function (nRow, aData, iDataIndex) { $(nRow).attr('data-type', 'selectable'); $(nRow).attr('data-username', aData["filter"]); - } + }; + //noinspection JSUnusedLocalSymbols var columns = [ { class: "remove-padding icon-only content-fill", data: null, - defaultContent: '
' + defaultContent: '
' + + '' + + '
' }, { class: "fade-edge", data: null, - render: function ( data, type, row, meta ) { + render: function (data, type, row, meta) { return '

' + data.firstname + ' ' + data.lastname + '

'; } }, { class: "fade-edge remove-padding-top", data: 'filter', - render: function ( filter, type, row, meta ) { + render: function (filter, type, row, meta) { return ' ' + filter; } }, { class: "fade-edge remove-padding-top", data: null, - render: function ( data, type, row, meta ) { + render: function (data, type, row, meta) { return ' ' + data.emailAddress + ' '; } }, { class: "text-right content-fill text-left-on-grid-view no-wrap", data: null, - render: function ( data, type, row, meta ) { - return ' ' + - ' ' + - ' ' + - - ' ' + + ' ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + - ' ' + - ' ' + - - ' ' + - ' <' + - '/i> ' + - ' ' + '' + + '' + + '' + + '' + + '' + + ''; } } ]; - var options = { "placeholder": "Search By Username", "searchKey" : "filter" @@ -347,7 +366,6 @@ function loadUsers(searchParam) { $("#loading-content").hide(); - // $("#loading-content").show(); // var userListing = $("#user-listing"); // var userListingSrc = userListing.attr("src"); @@ -410,7 +428,6 @@ function loadUsers(searchParam) { $(document).ready(function () { loadUsers(); - $(".viewEnabledIcon").click(function () { InitiateViewOption(); });