• 1986anuj
  • NEWBIE
  • 0 Points
  • Member since 2009

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 12
    Replies

Hi,

 

I am trying to create a field to display a dynamic value.

Like, i have taken three number fields, now i want to  enter the numbers into first 2 fields and the third fiels should show the product of field1 and field2.

How can we do this?

 

thanks,

Anuj 

Hello,

 

Can we share our current building application with other salesforce.com user?

If yes, how?? 

Hi,

 

I am trying to add new details using an ext js form.As well as i am showing the addeed details into a grid panes just besides it.

Currently i have to refresh the whole page after adding a new record to update it into grid panel.

Please let me know how can i refresh the grid without refreshing the whole page.

 

I have added setRedirect code in save method of controller which recalls the same page, but it results into showing the Page Editor tab 2-3 times.

 

Here is my save method code.

 

 

public PageReference doSave()

{

PageReference pRef;

insert data;

pRef = Page.Employee;

pRef.setRedirect(true);

return pRef;

}

 

 

 

 

Message Edited by 1986anuj on 04-13-2009 01:01 AM

Hello,

 

I am trying to add a edit button at the end of each record i have displayed in a pageblockSection.

This edit button, when clicked, should display the fields to be edited into an another page block just below it.

Please let me know which query i need to use in edit method of apex class.

Below is the VF and Controller code -

 

VF Code -

 

 

<apex:page Controller="JobPortal" sidebar="false">

<apex:relatedList list="OpenActivities" subject="{!$CurrentPage.parameters.relatedId}" />

<apex:form id="form">

<apex:pageBlock title="My Details" id="data" mode="edit">

<apex:pageBlockSection title="All Details" id="detail">

<apex:pageBlockTable value="{!details}" var="p">

<apex:column value="{!p.Name}"/>

<apex:column value="{!p.First_Name__c}"/>

<apex:column value="{!p.Last_Name__c}"/>

<apex:column>

<apex:commandButton action="{!edit}" value="Edit" reRender="edit"/>

</apex:column>

</apex:pageBlockTable>

</apex:pageBlockSection>

<apex:pageBlockSection title="Edit Details" id="edit">

<apex:inputField value="{!test.First_Name__c}"/>

<apex:inputField value="{!test.Last_Name__c}"/>

<apex:commandButton action="{!save}" value="save" reRender="detail"/>

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form></apex:page>

 

 

 Controller Code - 

 

 

public class JobPortal

{

public Job_Portal__c test=null;

List<Job_Portal__c> details;

public Job_Portal__c getTest()

{

if(test==null)

{

test = [select First_Name__c, Last_Name__c from Job_Portal__c limit 1];

} return test;

}

public List<Job_Portal__c> getDetails()

{

return [select Name, First_Name__c, Last_Name__c from Job_Portal__c];

}

 

public PageReference edit()

{

test=[select First_Name__c, Last_Name__c from Job_Portal__c where First_Name__c='Gaurav' limit 1];

return null;

}

public PageReference save()

{

try {

//upsert(portal);

update(test);

}

catch(System.DMLException e)

{

ApexPages.addMessages(e);

return null;

}

// After Save, navigate to the default view page:

//return (new ApexPages.StandardController(portal)).view();

return null;

}

}

 

 

 

 

 

Message Edited by 1986anuj on 03-20-2009 02:43 AM
Message Edited by 1986anuj on 03-20-2009 02:47 AM

Hello,

 

 

Can we create workflow using apex and VF page?

Please help me with any tutorial or example for it.

 

thanks,

Anuj 

Hi, I am trying to create a form using extjs and adding a save button to it which will save the data into salesfroce database.But its not working for me...

Below is the VF code  and the controller code.

 

 

<apex:page controller="EmployeeData" sidebar="false">

 

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

 

<script type="text/javascript">

Ext.onReady(function(){

var employee_form = new Ext.FormPanel({

labelWidth: 75,

url: "{!save}",

title:'Employee Details',

frame:true,

width:500,

items: [{xtype: 'textfield', fieldLabel: 'Employee Name',name: 'empName'},

{xtype: 'textfield', fieldLabel: 'Employee Code',name: 'empNo'},

{xtype: 'textfield', fieldLabel: 'Designation',name: 'desig'}],

buttons: [{text: 'Save'}]

});

 

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var myDataString = 'var myData = [ ';

<apex:repeat value="{!employeeData1}" var="e" id="ContactRepeat">

myDataString += "['{!e.Employee_Code__c}','{!e.Employee_Name__c}','{!e.Designation__c}'],";

</apex:repeat>

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

eval(myDataString);

var store = new

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

 

// CREATE THE GRID

 

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

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

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

{id: 'Designation__c', header: "Designation", width: 150, sortable: true,frame:true, dataIndex: 'Designation__c'} ],stripeRows:true,frame:true, autoExpandColumn: 'Employee_Code__c', height: 230, width: 500, title: 'MY EXT JS EMPLOYEE\'S CONTACT LIST'});

employee_form.render('employeeDetails');

grid.render('myContactList-grid');

grid.getSelectionModel().selectFirstRow();

});

</script>

 

<div id="employeeDetails"></div>

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

 

</apex:page>

 Controller code is - 

 

 

public class EmployeeData {

List<Employee__c> emp;

String employeeName;

public List<Employee__c> getEmployeeData1()

{

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

}

public String getEmployeeName()

{

return employeeName;

}

public PageReference save()

{

//Insert code

return null;

}

}

 

 The save button is not working and i am getting errror -

 

 

Save error: Unknown property 'EmployeeData.save' Employee.page TestProject/src/pages

 

 

 

 

Message Edited by 1986anuj on 03-09-2009 06:11 AM

Hello,

 

i have used following simple code for testing ExtJS Grid in VF  page.

The code is alright i think, as i have taken it from ExtJs Book.

Please let me know how will it work.

Code is below..

 

 

<script type="text/javascript">

Ext.onReady(function()

{// add your data store here

var grid = new Ext.grid.GridPanel({

renderTo: document.body,

frame:true,

title: 'Movie Database',

height:200,

width:500,

store: store,columns: [

{header: "Title", dataIndex: 'title'},

{header: "Director", dataIndex: 'director'},

{header: "Released", dataIndex: 'released',

renderer: Ext.util.Format.dateRenderer('m/d/Y')},

{header: "Genre", dataIndex: 'genre'},

{header: "Tagline", dataIndex: 'tagline'}

]

});

});

</script>

 

 

 

Message Edited by 1986anuj on 02-20-2009 07:45 AM

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

Hi,

 

I have created a small vf page with extJs included.Its not giving any error but its not working,i cannot see anything on page.

 

Here is the code i have written.Please let me know how will it work??

 

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

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

<script type="text/javascript" src="{!$Resource.ExtJs}/ext-2.1/ext-all.js"></script>

<apex:page>

<!-- Begin Default Content REMOVE THIS -->

<h1>Congratulations</h1>

This is your new Page

<script type="text/javascript">

Ext.onReady(function(){

Ext.Msg.show({

title: 'Milton',

msg: 'Have you seen my stapler?',

buttons: {

yes: true,

no: true,

cancel: true

}

});

});

</script>

</apex:page> 

Hi,

 

I am trying to create a field to display a dynamic value.

Like, i have taken three number fields, now i want to  enter the numbers into first 2 fields and the third fiels should show the product of field1 and field2.

How can we do this?

 

thanks,

Anuj 

Hi,

 

I am trying to add new details using an ext js form.As well as i am showing the addeed details into a grid panes just besides it.

Currently i have to refresh the whole page after adding a new record to update it into grid panel.

Please let me know how can i refresh the grid without refreshing the whole page.

 

I have added setRedirect code in save method of controller which recalls the same page, but it results into showing the Page Editor tab 2-3 times.

 

Here is my save method code.

 

 

public PageReference doSave()

{

PageReference pRef;

insert data;

pRef = Page.Employee;

pRef.setRedirect(true);

return pRef;

}

 

 

 

 

Message Edited by 1986anuj on 04-13-2009 01:01 AM

Hi, I am trying to create a form using extjs and adding a save button to it which will save the data into salesfroce database.But its not working for me...

Below is the VF code  and the controller code.

 

 

<apex:page controller="EmployeeData" sidebar="false">

 

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

 

<script type="text/javascript">

Ext.onReady(function(){

var employee_form = new Ext.FormPanel({

labelWidth: 75,

url: "{!save}",

title:'Employee Details',

frame:true,

width:500,

items: [{xtype: 'textfield', fieldLabel: 'Employee Name',name: 'empName'},

{xtype: 'textfield', fieldLabel: 'Employee Code',name: 'empNo'},

{xtype: 'textfield', fieldLabel: 'Designation',name: 'desig'}],

buttons: [{text: 'Save'}]

});

 

Ext.state.Manager.setProvider(new Ext.state.CookieProvider());

var myDataString = 'var myData = [ ';

<apex:repeat value="{!employeeData1}" var="e" id="ContactRepeat">

myDataString += "['{!e.Employee_Code__c}','{!e.Employee_Name__c}','{!e.Designation__c}'],";

</apex:repeat>

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

eval(myDataString);

var store = new

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

 

// CREATE THE GRID

 

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

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

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

{id: 'Designation__c', header: "Designation", width: 150, sortable: true,frame:true, dataIndex: 'Designation__c'} ],stripeRows:true,frame:true, autoExpandColumn: 'Employee_Code__c', height: 230, width: 500, title: 'MY EXT JS EMPLOYEE\'S CONTACT LIST'});

employee_form.render('employeeDetails');

grid.render('myContactList-grid');

grid.getSelectionModel().selectFirstRow();

});

</script>

 

<div id="employeeDetails"></div>

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

 

</apex:page>

 Controller code is - 

 

 

public class EmployeeData {

List<Employee__c> emp;

String employeeName;

public List<Employee__c> getEmployeeData1()

{

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

}

public String getEmployeeName()

{

return employeeName;

}

public PageReference save()

{

//Insert code

return null;

}

}

 

 The save button is not working and i am getting errror -

 

 

Save error: Unknown property 'EmployeeData.save' Employee.page TestProject/src/pages

 

 

 

 

Message Edited by 1986anuj on 03-09-2009 06:11 AM

How to a get database information... last id inserted

then pass that variable into a second web form?

Hello,

 

i have used following simple code for testing ExtJS Grid in VF  page.

The code is alright i think, as i have taken it from ExtJs Book.

Please let me know how will it work.

Code is below..

 

 

<script type="text/javascript">

Ext.onReady(function()

{// add your data store here

var grid = new Ext.grid.GridPanel({

renderTo: document.body,

frame:true,

title: 'Movie Database',

height:200,

width:500,

store: store,columns: [

{header: "Title", dataIndex: 'title'},

{header: "Director", dataIndex: 'director'},

{header: "Released", dataIndex: 'released',

renderer: Ext.util.Format.dateRenderer('m/d/Y')},

{header: "Genre", dataIndex: 'genre'},

{header: "Tagline", dataIndex: 'tagline'}

]

});

});

</script>

 

 

 

Message Edited by 1986anuj on 02-20-2009 07:45 AM

Hi,

 

I have created a small vf page with extJs included.Its not giving any error but its not working,i cannot see anything on page.

 

Here is the code i have written.Please let me know how will it work??

 

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

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

<script type="text/javascript" src="{!$Resource.ExtJs}/ext-2.1/ext-all.js"></script>

<apex:page>

<!-- Begin Default Content REMOVE THIS -->

<h1>Congratulations</h1>

This is your new Page

<script type="text/javascript">

Ext.onReady(function(){

Ext.Msg.show({

title: 'Milton',

msg: 'Have you seen my stapler?',

buttons: {

yes: true,

no: true,

cancel: true

}

});

});

</script>

</apex:page>