-
ChatterFeed
-
0Best Answers
-
0Likes Received
-
0Likes Given
-
7Questions
-
5Replies
How to add on mouse over functionality in a column in lightning table?
requirements -
on mouse over the "manager" column should show an manager column along with an arrow.
component-
<th class="slds-is-sortable slds-text-title--caps" scope="col" onmouseover="{!c.arrowshow}" onclick="{!c.sortManager}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↓ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↑ </aura:if>
</div></th>
controller.js-
sortManager: function(component, event, helper) {
try {
component.set("v.selectedTabsoft", 'Manager');
helper.sortManagerHelper(component, event, 'Manager');
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
arrowshow: function(component, event, helper) {
var arw = component.find('Manager');
$A.util.addClass(arw,'arrowdown');
},
helper-
sortManagerHelper: function(component, event, sortField,isAsc) {
try {
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
component.set("v.arrowDirection", 'arrowup');
component.set("v.isAsc", true);
component.set("v.isSort", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
component.set("v.isSort", true);
}
this.doinitHelper(component, event);
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
on mouse over the "manager" column should show an manager column along with an arrow.
component-
<th class="slds-is-sortable slds-text-title--caps" scope="col" onmouseover="{!c.arrowshow}" onclick="{!c.sortManager}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↓ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↑ </aura:if>
</div></th>
controller.js-
sortManager: function(component, event, helper) {
try {
component.set("v.selectedTabsoft", 'Manager');
helper.sortManagerHelper(component, event, 'Manager');
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
arrowshow: function(component, event, helper) {
var arw = component.find('Manager');
$A.util.addClass(arw,'arrowdown');
},
helper-
sortManagerHelper: function(component, event, sortField,isAsc) {
try {
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
component.set("v.arrowDirection", 'arrowup');
component.set("v.isAsc", true);
component.set("v.isSort", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
component.set("v.isSort", true);
}
this.doinitHelper(component, event);
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
- Amrita Panda 2
- January 09, 2019
- Like
- 0
- Continue reading or reply
How to sort manager field in both ascending and descending order in apex class?
component -
<th class="slds-is-sortable slds-text-title--caps" scope="col" onclick="{!c.sortName}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ▼ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ▲ </aura:if>
</div></th>
controller.js
sortName: function(component, event, helper) {
// set current selected header field on selectedTabsoft attribute.
component.set("v.selectedTabsoft", 'Manager');
// call the helper function with pass sortField Name
helper.sortHelper(component, event, 'Manager');
},
Helper.js
doinitHelper: function(component,event,QueueId){
var action = component.get("c.fetchsearchuser");
action.setParams({
'SearchUserKeyword': ''
});
component.find("Id_spinner").set("v.class" , 'slds-show');
// Tab Name
var workspaceAPI = component.find("workspace");
var TabName = component.get("v.TabName");
workspaceAPI.getEnclosingTabId().then(function(tabId) {
var focusedTabId = tabId;
workspaceAPI.setTabLabel({
tabId: focusedTabId,
label: TabName
});
workspaceAPI.setTabIcon({
tabId: focusedTabId,
icon: "standard:user",
});
})
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
component.find("Id_spinner").set("v.class" , 'slds-hide');
var storeResponse = response.getReturnValue();
console.log('User Load on Queue click'+storeResponse);
// set searchResult list with return value from server.
component.set("v.UserResult", storeResponse);
//for(var i= 0; i<storeResponse.length; i++ )
//alert(storeResponse[i].Role);
component.set("v.ShowUserTable", true);
}
});
$A.enqueueAction(action);
},
sortHelper: function(component, event, sortFieldName) {
var action = component.get("c.fetchname");
action.setParams({
'sortField': ''
});
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
// set the arrowDirection attribute for conditionally rendred arrow sign
component.set("v.arrowDirection", 'arrowup');
// set the isAsc flag to true for sort in Assending order.
component.set("v.isAsc", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
}
// call the onLoad function for call server side method with pass sortFieldName
this.doinitHelper(component, event, sortFieldName);
},
apex class-
@AuraEnabled
public static list < User > fetchname(String sortField, boolean isAsc) {
String sSoql = 'SELECT Manager.name';
sSoql += 'From User';
system.debug('sortField-->' + sortField);
if (sortField != '') {
sSoql += ' order by ' + sortField;
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
sSoql += ' asc';
} else {
sSoql += ' desc';
}
}
// set record limit to query
sSoql += ' LIMIT 20';
System.debug('@Developer -->sSoql:' + sSoql);
list <User> lstResult;
try {
system.debug('The query is' + sSoql);
lstResult = Database.query(sSoql);
List < User > returnConList = new List < User > ();
for (User c: lstResult) {
returnConList.add(c);
}
return returnConList;
}
catch (Exception ex) {
// for handle Exception
return null;
}
}
<th class="slds-is-sortable slds-text-title--caps" scope="col" onclick="{!c.sortName}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ▼ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ▲ </aura:if>
</div></th>
controller.js
sortName: function(component, event, helper) {
// set current selected header field on selectedTabsoft attribute.
component.set("v.selectedTabsoft", 'Manager');
// call the helper function with pass sortField Name
helper.sortHelper(component, event, 'Manager');
},
Helper.js
doinitHelper: function(component,event,QueueId){
var action = component.get("c.fetchsearchuser");
action.setParams({
'SearchUserKeyword': ''
});
component.find("Id_spinner").set("v.class" , 'slds-show');
// Tab Name
var workspaceAPI = component.find("workspace");
var TabName = component.get("v.TabName");
workspaceAPI.getEnclosingTabId().then(function(tabId) {
var focusedTabId = tabId;
workspaceAPI.setTabLabel({
tabId: focusedTabId,
label: TabName
});
workspaceAPI.setTabIcon({
tabId: focusedTabId,
icon: "standard:user",
});
})
action.setCallback(this, function(response) {
var state = response.getState();
if (state === "SUCCESS") {
component.find("Id_spinner").set("v.class" , 'slds-hide');
var storeResponse = response.getReturnValue();
console.log('User Load on Queue click'+storeResponse);
// set searchResult list with return value from server.
component.set("v.UserResult", storeResponse);
//for(var i= 0; i<storeResponse.length; i++ )
//alert(storeResponse[i].Role);
component.set("v.ShowUserTable", true);
}
});
$A.enqueueAction(action);
},
sortHelper: function(component, event, sortFieldName) {
var action = component.get("c.fetchname");
action.setParams({
'sortField': ''
});
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
// set the arrowDirection attribute for conditionally rendred arrow sign
component.set("v.arrowDirection", 'arrowup');
// set the isAsc flag to true for sort in Assending order.
component.set("v.isAsc", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
}
// call the onLoad function for call server side method with pass sortFieldName
this.doinitHelper(component, event, sortFieldName);
},
apex class-
@AuraEnabled
public static list < User > fetchname(String sortField, boolean isAsc) {
String sSoql = 'SELECT Manager.name';
sSoql += 'From User';
system.debug('sortField-->' + sortField);
if (sortField != '') {
sSoql += ' order by ' + sortField;
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
sSoql += ' asc';
} else {
sSoql += ' desc';
}
}
// set record limit to query
sSoql += ' LIMIT 20';
System.debug('@Developer -->sSoql:' + sSoql);
list <User> lstResult;
try {
system.debug('The query is' + sSoql);
lstResult = Database.query(sSoql);
List < User > returnConList = new List < User > ();
for (User c: lstResult) {
returnConList.add(c);
}
return returnConList;
}
catch (Exception ex) {
// for handle Exception
return null;
}
}
- Amrita Panda 2
- December 19, 2018
- Like
- 0
- Continue reading or reply
Getting this error " Illegal assignment from String to List<User> "..Need help
@AuraEnabled
public static List <User> fetchSearchQueueUser(String SearchUserKeyword, String grpId) {
try{
string searchkey = '%'+ SearchUserKeyword + '%';
List <User> returnList = new List <User> ();
List <User> lstOfUser;
String sortField ;
boolean isAsc;
List <String> lstOfSubGroup= new List <String> ();
List <String> lstOfUserIds = new List <String> ();
set <String> lstOfGrpIds = new set <String> ();
List <GroupMember> lstOfGroupMember;
List <GroupMember> lstOfSubGroupMember;
Set<id> idGroup = new Set<id>();
//To get subgroup:
lstOfSubGroupMember = [SELECT UserOrGroupId,Group.Name from GroupMember WHERE GroupId=: grpId LIMIT 500];
for(GroupMember gm : lstOfSubGroupMember){
if(String.Valueof(gm.UserOrGroupId).startsWith('00G')){
idGroup.add(gm.UserOrGroupId);
}
}
lstOfGroupMember = [SELECT Id,UserOrGroupId,GroupId from GroupMember WHERE GroupId IN: idGroup LIMIT 500];
for(GroupMember gm : lstOfGroupMember){
lstOfUserIds.add(gm.UserOrGroupId);
}
system.debug(searchkey);
if(string.isBlank(searchKey)){
lstOfUser = [select id,name,federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
if (sortField != '') {
lstOfUser += ' order by ' + sortField; ---------------------------------------------------->error
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
lstOfUser += ' asc'; ---------------------------------------------------->error
} else {
lstOfUser += ' desc'; ---------------------------------------------------->error
}
}
}
else{
lstOfUser = [select id,name, federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and (federationIdentifier like: searchkey or name like: searchkey) and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
}
system.debug(lstOfUser);
return lstOfUser;
}
catch(Exception e)
{
System.debug('The following exception has occurred: ' + e.getMessage());
return null;
}
public static List <User> fetchSearchQueueUser(String SearchUserKeyword, String grpId) {
try{
string searchkey = '%'+ SearchUserKeyword + '%';
List <User> returnList = new List <User> ();
List <User> lstOfUser;
String sortField ;
boolean isAsc;
List <String> lstOfSubGroup= new List <String> ();
List <String> lstOfUserIds = new List <String> ();
set <String> lstOfGrpIds = new set <String> ();
List <GroupMember> lstOfGroupMember;
List <GroupMember> lstOfSubGroupMember;
Set<id> idGroup = new Set<id>();
//To get subgroup:
lstOfSubGroupMember = [SELECT UserOrGroupId,Group.Name from GroupMember WHERE GroupId=: grpId LIMIT 500];
for(GroupMember gm : lstOfSubGroupMember){
if(String.Valueof(gm.UserOrGroupId).startsWith('00G')){
idGroup.add(gm.UserOrGroupId);
}
}
lstOfGroupMember = [SELECT Id,UserOrGroupId,GroupId from GroupMember WHERE GroupId IN: idGroup LIMIT 500];
for(GroupMember gm : lstOfGroupMember){
lstOfUserIds.add(gm.UserOrGroupId);
}
system.debug(searchkey);
if(string.isBlank(searchKey)){
lstOfUser = [select id,name,federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
if (sortField != '') {
lstOfUser += ' order by ' + sortField; ---------------------------------------------------->error
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
lstOfUser += ' asc'; ---------------------------------------------------->error
} else {
lstOfUser += ' desc'; ---------------------------------------------------->error
}
}
}
else{
lstOfUser = [select id,name, federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and (federationIdentifier like: searchkey or name like: searchkey) and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
}
system.debug(lstOfUser);
return lstOfUser;
}
catch(Exception e)
{
System.debug('The following exception has occurred: ' + e.getMessage());
return null;
}
- }
- Amrita Panda 2
- December 11, 2018
- Like
- 0
- Continue reading or reply
How to use browser scrollbar to scroll the table data?
I have created a lighting component in which there is a table..Now i am having 2 scrollbars(one for the browser and another for the table data)..How to merge both the scrollbars into one(i.e, the browser scrollbar)...
- Amrita Panda 2
- November 14, 2018
- Like
- 0
- Continue reading or reply
- Amrita Panda 2
- October 18, 2018
- Like
- 0
- Continue reading or reply
How to add on mouse over functionality in a column in lightning table?
requirements -
on mouse over the "manager" column should show an manager column along with an arrow.
component-
<th class="slds-is-sortable slds-text-title--caps" scope="col" onmouseover="{!c.arrowshow}" onclick="{!c.sortManager}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↓ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↑ </aura:if>
</div></th>
controller.js-
sortManager: function(component, event, helper) {
try {
component.set("v.selectedTabsoft", 'Manager');
helper.sortManagerHelper(component, event, 'Manager');
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
arrowshow: function(component, event, helper) {
var arw = component.find('Manager');
$A.util.addClass(arw,'arrowdown');
},
helper-
sortManagerHelper: function(component, event, sortField,isAsc) {
try {
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
component.set("v.arrowDirection", 'arrowup');
component.set("v.isAsc", true);
component.set("v.isSort", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
component.set("v.isSort", true);
}
this.doinitHelper(component, event);
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
on mouse over the "manager" column should show an manager column along with an arrow.
component-
<th class="slds-is-sortable slds-text-title--caps" scope="col" onmouseover="{!c.arrowshow}" onclick="{!c.sortManager}"><div class="slds-truncate slds-cell-fixed" style="width: 980px;padding-left: 10px;padding-top: 10px;" title="Manager">Manager
<aura:if isTrue="{! and(v.arrowDirection == 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↓ </aura:if>
<aura:if isTrue="{! and(v.arrowDirection != 'arrowdown', v.selectedTabsoft == 'Manager') }"> ↑ </aura:if>
</div></th>
controller.js-
sortManager: function(component, event, helper) {
try {
component.set("v.selectedTabsoft", 'Manager');
helper.sortManagerHelper(component, event, 'Manager');
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
arrowshow: function(component, event, helper) {
var arw = component.find('Manager');
$A.util.addClass(arw,'arrowdown');
},
helper-
sortManagerHelper: function(component, event, sortField,isAsc) {
try {
var currentDir = component.get("v.arrowDirection");
if (currentDir == 'arrowdown') {
component.set("v.arrowDirection", 'arrowup');
component.set("v.isAsc", true);
component.set("v.isSort", true);
} else {
component.set("v.arrowDirection", 'arrowdown');
component.set("v.isAsc", false);
component.set("v.isSort", true);
}
this.doinitHelper(component, event);
}
catch(Err){
helper.showToast(component, 'Error',"Error Occured While Loading Component", "Error");
}
},
- Amrita Panda 2
- January 09, 2019
- Like
- 0
- Continue reading or reply
Getting this error " Illegal assignment from String to List<User> "..Need help
@AuraEnabled
public static List <User> fetchSearchQueueUser(String SearchUserKeyword, String grpId) {
try{
string searchkey = '%'+ SearchUserKeyword + '%';
List <User> returnList = new List <User> ();
List <User> lstOfUser;
String sortField ;
boolean isAsc;
List <String> lstOfSubGroup= new List <String> ();
List <String> lstOfUserIds = new List <String> ();
set <String> lstOfGrpIds = new set <String> ();
List <GroupMember> lstOfGroupMember;
List <GroupMember> lstOfSubGroupMember;
Set<id> idGroup = new Set<id>();
//To get subgroup:
lstOfSubGroupMember = [SELECT UserOrGroupId,Group.Name from GroupMember WHERE GroupId=: grpId LIMIT 500];
for(GroupMember gm : lstOfSubGroupMember){
if(String.Valueof(gm.UserOrGroupId).startsWith('00G')){
idGroup.add(gm.UserOrGroupId);
}
}
lstOfGroupMember = [SELECT Id,UserOrGroupId,GroupId from GroupMember WHERE GroupId IN: idGroup LIMIT 500];
for(GroupMember gm : lstOfGroupMember){
lstOfUserIds.add(gm.UserOrGroupId);
}
system.debug(searchkey);
if(string.isBlank(searchKey)){
lstOfUser = [select id,name,federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
if (sortField != '') {
lstOfUser += ' order by ' + sortField; ---------------------------------------------------->error
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
lstOfUser += ' asc'; ---------------------------------------------------->error
} else {
lstOfUser += ' desc'; ---------------------------------------------------->error
}
}
}
else{
lstOfUser = [select id,name, federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and (federationIdentifier like: searchkey or name like: searchkey) and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
}
system.debug(lstOfUser);
return lstOfUser;
}
catch(Exception e)
{
System.debug('The following exception has occurred: ' + e.getMessage());
return null;
}
public static List <User> fetchSearchQueueUser(String SearchUserKeyword, String grpId) {
try{
string searchkey = '%'+ SearchUserKeyword + '%';
List <User> returnList = new List <User> ();
List <User> lstOfUser;
String sortField ;
boolean isAsc;
List <String> lstOfSubGroup= new List <String> ();
List <String> lstOfUserIds = new List <String> ();
set <String> lstOfGrpIds = new set <String> ();
List <GroupMember> lstOfGroupMember;
List <GroupMember> lstOfSubGroupMember;
Set<id> idGroup = new Set<id>();
//To get subgroup:
lstOfSubGroupMember = [SELECT UserOrGroupId,Group.Name from GroupMember WHERE GroupId=: grpId LIMIT 500];
for(GroupMember gm : lstOfSubGroupMember){
if(String.Valueof(gm.UserOrGroupId).startsWith('00G')){
idGroup.add(gm.UserOrGroupId);
}
}
lstOfGroupMember = [SELECT Id,UserOrGroupId,GroupId from GroupMember WHERE GroupId IN: idGroup LIMIT 500];
for(GroupMember gm : lstOfGroupMember){
lstOfUserIds.add(gm.UserOrGroupId);
}
system.debug(searchkey);
if(string.isBlank(searchKey)){
lstOfUser = [select id,name,federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
if (sortField != '') {
lstOfUser += ' order by ' + sortField; ---------------------------------------------------->error
// if isAsc is equal tp ture then set 'asc' order otherwise set 'desc' order.
if (isAsc) {
lstOfUser += ' asc'; ---------------------------------------------------->error
} else {
lstOfUser += ' desc'; ---------------------------------------------------->error
}
}
}
else{
lstOfUser = [select id,name, federationIdentifier,userrole.name,Manager.name,profile.name from user where Id IN: lstOfUserIds and (federationIdentifier like: searchkey or name like: searchkey) and profile.name in ('Service Agent','Work Order Approver') order by name asc LIMIT 500];
}
system.debug(lstOfUser);
return lstOfUser;
}
catch(Exception e)
{
System.debug('The following exception has occurred: ' + e.getMessage());
return null;
}
- }
- Amrita Panda 2
- December 11, 2018
- Like
- 0
- Continue reading or reply