• vshinde
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies

Hi all,

              I have created a VF page using extjs. It displays a an editable grid with values from object created in salesforce.

Now , what I want to do is save the changes made in the editable fields. Right now whatever changes I make in the editable fields are not saved. I want the modified records to be saved in store as well be updated in salesforce.Please help.....

 Here is my  vf page:

   <apex:page Controller="ProjectGrid">
   <link rel="Stylesheet" type="text/css" href="{!$Resource.ExtJs}/extjs/resources/css/ext-all.css" />
    <apex:includeScript value="{!$Resource.ExtJs}/extjs/adapter/ext/ext-base.js"/>
    <apex:includeScript value="{!$Resource.ExtJs}/extjs/ext-all.js"/>
    <script>

    Ext.onReady(function(){
   

    var buttonHandler = function(button,event) {
              
                    alert("Button 1 is Clicked");
                    };
        var button1 = new Ext.Button({applyTo:'m',text:'Button 1',handler:buttonHandler});
       var myDataString = 'var empGridRec = [ ';
            <apex:repeat value="{!proj}" var="con" >
            myDataString += "['{!con.Id}','{!con.Name}','{!con.Objective__c}','{!con.Description__c}','{!con.Start_date__c}'],";
            </apex:repeat>
            myDataString += "['','',''] ];";
            eval(myDataString);
  

    var store = new Ext.data.ArrayStore({

    fields : [

    { name: 'ID' },

    { name: 'Name' },

    { name: 'Obj' },

    { name: 'Desc' },
    
    { name: 'date' }
    

    ]    

    });
    
    store.loadData(empGridRec);
    
    var empColumnModel = new Ext.grid.ColumnModel ({
    columns:

    [{
      id:'ID' ,
    header: 'Employee Number',

    readOnly: true,

    width: 100,

    sortable: true,
    
     editor: true

   
    },

    {
     id:'Name',
    header: 'Name',

    readOnly: true,

    width: 150,

    sortable: false,
     editor: true

 
    },

    {
      id:'Obj',
    header: 'Designation',

    readOnly: true,

    width: 100,

    sortable: true,

   
     editor: true

    },
     {
      id:'Desc',
    header: 'Designation',

    readOnly: true,

    width: 100,

    sortable: true,

     editor: true

    },

    {
      id:'date',
    header: 'Salary',

    readOnly: true,

    width: 75,

    sortable: true,

  

    editor: new Ext.form.NumberField({

    allowDecimals: true

    })

    }]

    });

    var empGrid = new Ext.grid.EditorGridPanel({

    store: store,
        cm: empColumnModel,
        renderTo: 'm',
        width: 600,
        height: 300,
         title: 'ABC',
        frame: true,
        items:button1,
        clicksToEdit: 1
       );
        


    });
   store.load();
 
    });
 
    </script>
<div id="m">
</div>
 
    </apex:page>

what i want to do is create a button on contacts page, on clicking this button a new opportunity page is to be opened with its Name to be populated with the product Name. my salesforce bros help me

Hi all,

              I have created a VF page using extjs. It displays a an editable grid with values from object created in salesforce.

Now , what I want to do is save the changes made in the editable fields. Right now whatever changes I make in the editable fields are not saved. I want the modified records to be saved in store as well be updated in salesforce.Please help.....

 Here is my  vf page:

   <apex:page Controller="ProjectGrid">
   <link rel="Stylesheet" type="text/css" href="{!$Resource.ExtJs}/extjs/resources/css/ext-all.css" />
    <apex:includeScript value="{!$Resource.ExtJs}/extjs/adapter/ext/ext-base.js"/>
    <apex:includeScript value="{!$Resource.ExtJs}/extjs/ext-all.js"/>
    <script>

    Ext.onReady(function(){
   

    var buttonHandler = function(button,event) {
              
                    alert("Button 1 is Clicked");
                    };
        var button1 = new Ext.Button({applyTo:'m',text:'Button 1',handler:buttonHandler});
       var myDataString = 'var empGridRec = [ ';
            <apex:repeat value="{!proj}" var="con" >
            myDataString += "['{!con.Id}','{!con.Name}','{!con.Objective__c}','{!con.Description__c}','{!con.Start_date__c}'],";
            </apex:repeat>
            myDataString += "['','',''] ];";
            eval(myDataString);
  

    var store = new Ext.data.ArrayStore({

    fields : [

    { name: 'ID' },

    { name: 'Name' },

    { name: 'Obj' },

    { name: 'Desc' },
    
    { name: 'date' }
    

    ]    

    });
    
    store.loadData(empGridRec);
    
    var empColumnModel = new Ext.grid.ColumnModel ({
    columns:

    [{
      id:'ID' ,
    header: 'Employee Number',

    readOnly: true,

    width: 100,

    sortable: true,
    
     editor: true

   
    },

    {
     id:'Name',
    header: 'Name',

    readOnly: true,

    width: 150,

    sortable: false,
     editor: true

 
    },

    {
      id:'Obj',
    header: 'Designation',

    readOnly: true,

    width: 100,

    sortable: true,

   
     editor: true

    },
     {
      id:'Desc',
    header: 'Designation',

    readOnly: true,

    width: 100,

    sortable: true,

     editor: true

    },

    {
      id:'date',
    header: 'Salary',

    readOnly: true,

    width: 75,

    sortable: true,

  

    editor: new Ext.form.NumberField({

    allowDecimals: true

    })

    }]

    });

    var empGrid = new Ext.grid.EditorGridPanel({

    store: store,
        cm: empColumnModel,
        renderTo: 'm',
        width: 600,
        height: 300,
         title: 'ABC',
        frame: true,
        items:button1,
        clicksToEdit: 1
       );
        


    });
   store.load();
 
    });
 
    </script>
<div id="m">
</div>
 
    </apex:page>

what i want to do is create a button on contacts page, on clicking this button a new opportunity page is to be opened with its Name to be populated with the product Name. my salesforce bros help me

Whoohooo. I have finally built out a Visual Force page that is ready for prime time but now I need to write the test classes for it.

Here is my stumbling block:

The page is launched from a Page Button on the Lead object ( /apex/mergeLeadToOpp?id={!Lead.Id} )

In the controller the following query is run that uses "System.currentPageReference().getParameters().get('id')"

mylead = [select Id, Name, etc, etc from Lead where ID = :System.currentPageReference().getParameters().get('id')];

Here is my test class (not even close to done) but I can't seem to get it to work. Any help is greatly appreciated.
Code:
public class mergeLeadToOppVFTEST {

  public static testMethod void testMyController() {
    
    Lead l = new Lead(
     Reseller_First_Name__c = 'Jason',
      Reseller_Last_Name__c = 'V',
      Reseller_Email__c = 'jv@f5.com',
      Reseller_Company_Name__c = 'VenTech',
      Reseller_Phone__c = '207-69H-8540',
      Distributor__c = 'Super Disiti',
      Software_Vendor__c = 'SFDC',
      Source_code__c = 'abcd'
    );
    
    insert l;
    
    //I think this is where my problem is. Here is what I have tried but with no luck
    Test.setCurrentPageReference(new PageReference('/apex/mergeLeadToOpp—id=' + l.id));
    Test.setCurrentPageReference(new PageReference('Page.mergeLeadToOpp–id=' + l.id));
    Test.setCurrentPageReference(new PageReference('Page.mergeLeadToOpp')); 
       
    mergeLeadToOppVF controller = new mergeLeadToOppVF();
    
    controller.settargetOpp('asdfasd');
    controller.mergeLead();
    
    String error = controller.getError();
    System.AssertEquals(error,'Link or ID must be at least 15 characters long.');    
  }
}

 



Message Edited by TehNrd on 04-19-2008 10:12 PM
  • April 18, 2008
  • Like
  • 0