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
1986anuj1986anuj 

VF + ExtJs not working

I am using the below VF page code and Apex ClassBut Not working !!!!! Can anyone tell me why ???

 

 

<apex:page controller="EmployeeData">

<link rel="Stylesheet" type="text/css" href="{!$Resource.ExtJS}/resources/css/ext-all.css" />

<script type="text/javascript" src="{!$Resource.ExtJS}/adapter/ext/ext-base.js"></script>

<script type="text/javascript" src="{!$Resource.ExtJS}/ext-all.js"></script>Congratulations !!!! {!$User.FirstName} <p/><p/><p/>

<apex:form>

<apex:pageBlock title="Congratulations {!$User.FirstName}">Your Name:

<apex:inputField value="{!employeeData1.Employee_Name__c}"/>

</apex:pageBlock>

</apex:form>

<script type="text/javascript">

Ext.onReady(function()

{

var myDataString = 'var myData = [ ';

<apex:repeat value="{!employeeData1}" var="emp" id="EmpRecords">

myDataString += "['{!employeeData1.Employee_Name__c}','{!employeeData1.Employee_Code__c}','{!employeeData1.Designation__c}'],"; </apex:repeat>

myDataString += "['','',''] ];";

eval(myDataString);

var store = new Ext.data.SimpleStore({fields:[{name:'Employee_Name__c'},{name:'Employee_Code__c'},{name:'Designation__c'}]}); store.loadData(myData);

var grid = new Ext.grid.GridPanel({store: store, columns: [

{id: 'Employee_Name__c', header: "Employee Name", width: 50, sortable: true, dataIndex: 'Employee_Name__c'},

{id: 'Employee_Code__c', header: "Employee Code", width: 150, sortable: true, dataIndex: 'Employee_Code__c'},

{id: 'Designation__c', header: "Designation", width: 150, sortable: true, dataIndex: 'Designation__c'}

],stripeRows:true, autoExpandColumn: 'Employee_Name__c', height: 500, width: 1000, title: 'MY EXT JS CONTACT LIST'});

grid.render('myContactList-grid');

grid.getSelectionModel().selectFirstRow();

});

<div id="myContactList-grid"></div>

</apex:page>

 

 Apex Class

 

 

public class EmployeeData

{

Employee__c emp;

public Employee__c getEmployeeData1()

{

emp = [select Employee_Name__c,Employee_Code__c, Designation__c from Employee__c limit 1];

return emp;

}

public PageReference save()

{

update(emp);

return null;

}

}

 

 Please let me know where i am going wrong.

I have inserted employee data. 

 

 

 

Message Edited by 1986anuj on 02-19-2009 09:24 AM
Message Edited by 1986anuj on 02-20-2009 01:12 AM
Shannon HaleShannon Hale

You are missing the closing </script> tag after your Ext.OnReady() call, before the div.

 

(I hope you figured this out already, but I figured I'd post the answer anyway for future readers.)