• kajal rathod
  • NEWBIE
  • 10 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi ,
I just sarted learning lightning and i am trying to insert data in my custom object from client side to server side but i m not able to .I try to debug also but it is showing value as undefined .
component----
<aura:component controller='TraningDetailsServer'>
    <aura:attribute name='TraningDetails' Type='List'  default="{ 'sobjectType': 'TraningDetails__c',
                     'Name': ' ',
                      'Employee ID': ' ',                                                       
                   }"/>
 
    <lightning:input name="TraningDetails" label="Name" value='{!v.TraningDetails.Name__c}'/>
    <lightning:input name="TraningDetails" label="Employee ID" value='{!v.TraningDetails.Emp_ID__c}'/>

    
  <ui:button label="Submit" 
                   class="slds-button slds-button--neutral"
                   labelClass="label"
                   press="{!c.getDetails}"/>
 
</aura:component>

controller---
({
    getDetails : function(component, event, helper) {
    var DetailsCmp=component.get("v.TraningDetails");
    //var item = JSON.parse(JSON.stringify(DetailsCmp));
    var action=component.get("c.TraningDetailsServer");
    console.log(DetailsCmp);
        var i;
        for(i in DetailsCmp)
        action.setParams({ 
            "xyz": JSON.stringify(DetailsCmp[i].Name)
    });
   
        action.setCallback(this, function(a) {
           var state = a.getState();
           console.log(state);
            if (state === "SUCCESS") {
                var DetailsCall = a.getReturnValue();
                alert("hello from here"+DetailsCall.Name);
              
            }
        });
        $A.enqueueAction(action)
    }
})

Apex class---
public with sharing class TraningDetailsServer {
   @AuraEnabled
    
    public static List<TraningDetails__c> TraningDetailsServer(List<TraningDetails__c> xyz)
    {
    
      insert xyz;
      return xyz;   
    }
}
 can some body help me with what is wrong in my code
Hi All,
I just started working on Lightning and i am stuck at this point --'can we apply permission set on Lightning component or How we can restrict one component for one particular user' 
Hi ,
I just sarted learning lightning and i am trying to insert data in my custom object from client side to server side but i m not able to .I try to debug also but it is showing value as undefined .
component----
<aura:component controller='TraningDetailsServer'>
    <aura:attribute name='TraningDetails' Type='List'  default="{ 'sobjectType': 'TraningDetails__c',
                     'Name': ' ',
                      'Employee ID': ' ',                                                       
                   }"/>
 
    <lightning:input name="TraningDetails" label="Name" value='{!v.TraningDetails.Name__c}'/>
    <lightning:input name="TraningDetails" label="Employee ID" value='{!v.TraningDetails.Emp_ID__c}'/>

    
  <ui:button label="Submit" 
                   class="slds-button slds-button--neutral"
                   labelClass="label"
                   press="{!c.getDetails}"/>
 
</aura:component>

controller---
({
    getDetails : function(component, event, helper) {
    var DetailsCmp=component.get("v.TraningDetails");
    //var item = JSON.parse(JSON.stringify(DetailsCmp));
    var action=component.get("c.TraningDetailsServer");
    console.log(DetailsCmp);
        var i;
        for(i in DetailsCmp)
        action.setParams({ 
            "xyz": JSON.stringify(DetailsCmp[i].Name)
    });
   
        action.setCallback(this, function(a) {
           var state = a.getState();
           console.log(state);
            if (state === "SUCCESS") {
                var DetailsCall = a.getReturnValue();
                alert("hello from here"+DetailsCall.Name);
              
            }
        });
        $A.enqueueAction(action)
    }
})

Apex class---
public with sharing class TraningDetailsServer {
   @AuraEnabled
    
    public static List<TraningDetails__c> TraningDetailsServer(List<TraningDetails__c> xyz)
    {
    
      insert xyz;
      return xyz;   
    }
}
 can some body help me with what is wrong in my code
Hello  I am trying using lightning:treeGrid  and i am facing this issue render threw an error in 'lightning:treeGrid' [can't convert undefined to object]

my component
<aura:component controller="Milestone" implements="flexipage:availableForAllPageTypes,flexipage:availableForRecordHome,force:hasRecordId" 
                access="global" >

    <aura:attribute name="gridCol" type="List" />
    <aura:attribute name="gridData" type="Object" />
    
    <aura:handler name="init" value="{!this}" action="{!c.doInitTree}"/>

    <lightning:treeGrid columns="{!v.gridCol}"
        data="{!v.gridData}"
        keyField="id"
        aura:id="mytree"
    />
</aura:component>
my Js Controller
 
public class Milestone {

    @AuraEnabled
    public static list<Stage__mdt> getlistTreeGrid(){
       list<Stage__mdt> listvaleur=new list<Stage__mdt>([SELECT  Label,IsSelect__c,(SELECT Label, IsSelect__c  FROM Jalons__r) FROM Stage__mdt]);
        return listvaleur;
    }

}
my apex controller
 
public class Milestone {

    @AuraEnabled
    public static list<Stage__mdt> getlistTreeGrid(){
       list<Stage__mdt> listvaleur=new list<Stage__mdt>([SELECT  Label,IsSelect__c,(SELECT Label, IsSelect__c  FROM Jalons__r) FROM Stage__mdt]);
        return listvaleur;
    }

}

the error screenshot

User-added image

what is the mistake ?


 
  • February 12, 2018
  • Like
  • 0