We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to do something when a cell is clicked?

Hi,

I want to do something on client side, such as:
When a cell is clicked, I will get it’s value and show somewhere(such as alert(“value of the cell”);), but I don’t know how to do, and where I can write the code.
Can anyone tell me? thanks!

Hi,


Please refer to Events demo under Commons folder (of GridWeb Demos ) on which events are supported and how to use the events for your reference.

Thank you.

Hi Amjad Sahi,

Thanks for replying. I tried with events.jsp, and the events of RowInserted/RowDeleted/… were quite properly working (I saw the changes in cell A1), but when I double clicked or clicked, nothing happened, why?
And what does the event of “CellClickOnAjax” mean? and no event of “CellClick” is found, why?

Thanks again!

Hi,


Well, there is no single cell click event at the moment, we may look over it in future. For CellClickOnAjax, well, it occurs when the cell is clicked and need to do ajaxcallback for this event.

For double click event, could you test it on IE browser (e.g IE9.0, IE6/7) if it works fine.

Thank you.

Hi,

I tried in IE9, but doubleclick didn’t make any change.
How can I trigger the CellClickOnAjax ?

Hi,


Thanks for the confirmation.

After an initial test, we found found that Double click event is not working in GridWeb (JAVA). I have logged a ticket with an id “CELLSJAVA-41075” for your issue. We will look into it to figure it out soon. Also, we will give details on how to use and handle CellClickOnAjax event.

Once we have any update on it, we will let you know here.

Thank you.
Hi,

Well, you will first select one cell by clicking the cell, then double click it, the cell will trigger the event. however if your double click is not quick enough, it will treat as one click and one click select and one click will come into edit value mode. As it is not so smooth you will not use it. you can use ajaxcallonclick instead.
see the below .jsp codes, you can put it under the gridweb demo root directory.
e.g
Sample code:

<%@ page language="java" contentType="text/html; charset=UTF-8" import="com.aspose.gridweb.*"
pageEncoding="UTF-8"%>
<%@include file="/head.jsp" %>
Insert title here
<%
ExtPage BeanManager=ExtPage.getInstance();
GridWebBean gridweb=BeanManager.getBean(request);
out.println(gridweb.getHTMLHead());
%>
hello world
<%
gridweb.setReqRes(request, response);
gridweb.ImportExcelFile("D:\\grid_project\\temp\\gridweb(java)0822\\sample\\WebRoot\\file\\list.xls");
WorkbookEventHandler we=new WorkbookEventHandler(){
public void handleCellEvent(Object sender, CellEventArgs e){
System.out.println("hSaveCommand");
}
};
CellEventHandler ceh=new CellEventHandler(){
public void handleCellEvent(Object sender, CellEventArgs e){
System.out.println("hello cell double click");
}
};
RowColumnEventHandler reh=new RowColumnEventHandler(){
public void handleCellEvent(Object sender, RowColumnEventArgs e){
System.out.println("hello row.... RowColumnEventArgs");
}
};

RowColumnEventHandler cdbclick=new RowColumnEventHandler(){
public void handleCellEvent(Object sender, RowColumnEventArgs e){
System.out.println("hello column double click");
}
};

CellEventStringHandler cesh=new CellEventStringHandler(){
public String handleCellEvent(Object sender, CellEventArgs e){
return e.getCell()+"$$$$hello_CellEventStringHandler";
}
};

CellEventHandler cellcommand=new CellEventHandler(){
public void handleCellEvent(Object sender, CellEventArgs e){
System.out.println("hello cellcommand"+e.getCell());
}
};

gridweb.setEnableDoubleClickEvent(true);
gridweb.SaveCommand=we;
gridweb.CellDoubleClick=ceh;
gridweb.RowDoubleClick=reh;
gridweb.ColumnDoubleClick=cdbclick;
gridweb.CellClickOnAjax=cesh;
gridweb.setOnCellSelectedAjaxCallBackClientFunction("dealwithcellselectcallback");
gridweb.CellCommand=cellcommand;

gridweb.prepareRender();

out.print(gridweb.getHTMLBody());
%>


Hope, this helps a bit.

Thank you.

Hi,


Hopefully, we will provide you the updated demo (in the demos archive) which is included in our next fix/version: aspose-gridweb-8.2.2.3-java

Once it is ready, we will attach it here.

Thank you.

Hi,


Please download the zipped archive that contains the updated demos (.WAR file) and latest version/fix: Aspose.Cells.GridWeb for JAVA v8.2.2.3 with its resource files

We have fixed your issue now. Please try it.

Let us know your feedback.

Thank you.