function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vshindevshinde 

Save in extjs editor grid

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>

Bhawani SharmaBhawani Sharma

youy need to bind the values with the object fields which you want to save. and then call an action using save button.

vshindevshinde

Thank you for replying,but can u specify with an example.I am newbie bare with me.