Created
July 3, 2018 13:46
-
-
Save choudharymanish8585/2859e75c75c923be28fb200fe3521ea3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
showListViewData : function(component, event, helper) { | |
var strValue = component.find("inputName").get("v.value"); | |
var setOptions = component.find("selectvalues"); | |
component.set("v.objName", strValue); | |
var action = component.get("c.fetchListViews"); | |
action.setParams({ | |
"strObjName" : strValue | |
}); | |
var optionValues = []; | |
action.setCallback(this, function(response){ | |
var state = response.getState(); | |
if(state == "SUCCESS") { | |
$A.util.removeClass(component.find('div1'), 'slds-hide'); | |
$A.util.addClass(component.find('div1'), 'slds-show'); | |
var listviewvalue = response.getReturnValue(); | |
if(listviewvalue != null && listviewvalue != undefined) { | |
optionValues.push({ | |
class:"optionclass", | |
label:"--None--", | |
value:"" | |
}); | |
} | |
for(var i=0; i<listviewvalue.length; i++) { | |
optionValues.push({ | |
class:"optionclass", | |
label:listviewvalue[i], | |
value:listviewvalue[i] | |
}); | |
} | |
setOptions.set("v.options", optionValues); | |
} | |
}); | |
$A.enqueueAction(action); | |
}, | |
showRecordsData : function(component, event, helper) { | |
var selectedName = component.find("selectvalues").get("v.value"); | |
var lstApi = selectedName.replace(/ /g,''); | |
component.set("v.viewName", lstApi); | |
component.set("v.body" , []); | |
$A.createComponent( | |
"lightning:listView", | |
{ | |
"objectApiName" : component.find("inputName").get("v.value"), | |
"listName" : component.get("v.viewName"), | |
"rows": 8, | |
"showActionBar":false, | |
"enableInlineEdit":true, | |
"showRowLevelActions":"true" | |
}, | |
function(newListView, status, errorMessage){ | |
if (status === "SUCCESS") { | |
var body = component.get("v.body"); | |
body.push(newListView); | |
component.set("v.body", body); | |
} | |
else if (status === "INCOMPLETE") { | |
console.log("No response from server or client is offline.") | |
} | |
else if (status === "ERROR") { | |
console.log("Error: " + errorMessage); | |
} | |
} | |
); | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment