PDA

View Full Version : Help with dynamic grid-row pop-up menu



M3mphiZ
7 May 2007, 12:26 PM
Hello,
Can anyone please guide with this issue I have:

I would like to create a pop-up menu just as the one which apears when you rigth-click on the grid titles, but I would like to create it when the user clicks on a single data row on the grid, so, for example, the user might want to delete a row just by right-clicking on one of them.

I really apreciate your help,


M3mphiZ ~o)

jsakalos
7 May 2007, 1:40 PM
Look for grid's contextmenu event.

jaffarsadik.k
16 Jul 2008, 8:40 PM
Hi,

Can u help me how to display Dynamic data on grid

Example:

I have one Java Bean called Employee. having set and get methods like ENo, Ename and Salary.
public class Employee
{
private int eno;
private String ename;
private float sal;
/**
* @return the ename
*/
public String getEname() {
return ename;
}
/**
* @param ename the ename to set
*/
public void setEname(String ename) {
this.ename = ename;
}
/**
* @return the eno
*/
public int getEno() {
return eno;
}
/**
* @param eno the eno to set
*/
public void setEno(int eno) {
this.eno = eno;
}
/**
* @return the sal
*/
public float getSal() {
return sal;
}
/**
* @param sal the sal to set
*/
public void setSal(float sal) {
this.sal = sal;
}
}
---------------------------------------

i written query fetching records from Database (called EMP table) and set into Employee Java Bean class.

EMP TABLE

ENO ENAME SAL
===============
10 JERRY 10000
20 ALBERT 15900
30 ADMIN 34200
40 DAVID 2300

PreparedStatement ps = con.prepareStatement("select eno, ename, sal from emp");ResultSet rs = ps.executeQuery();
Employee emp = new Employee();
ArrayList empList = new ArrayList();
while(rs.next())
{
emp.setEno(rs.getInt(1));
emp.setEname(rs.getString(2));
emp.setSal(rs.getFloat(3));
empList.add(emp);
}
HttpSession session = request.getSession();
session.setAttribute("result",empList); // i set the object(empList) in session object
------------------

In JSP i written like
<%

ArrayList emplist = (ArrayList)session.getAttribute("result");

// now displaying the values on JPS page
for(int i=0; i<emplist.size(); i++)
{
Employee e1 = (Employee)emplist.get(i);
out.println(e1.getEno());
out.println(e1.getEname());
out.println(e1.getSal());

}
%>
table having 4 rows set into ArrayList empList object.

My question is how can i retrive the data from ArrayList (empList) object in .js fle, display on grid dynamic using ExtJS?
+----------+-------------+----------------+
| ENO | ENAME | SALARY |
+----------+-------------+----------------+
| 10 | JERRY | 10000 |
+----------+-------------+----------------+
| 20 | ALBERT | 15900 |
+----------+-------------+----------------+
| 30 | ADMIN | 34200 |
+----------+-------------+----------------+
| 40 | DAVID | 2300 |
+----------+-------------+----------------+
Thanks & Regards

Jaffar Sadik.K
email: [email protected]
aol: allfonjaffar