Hi,
i have hidden variable which is update when the row is selected in GridView, and i need this value in java script, we are trying to modify in igf_grid.js
this.selectRow=function(domNode,select){
......}}this.customFLT()};
in the customFLT() method just i am tring to print value using alert(of javascript) method, which works fine and i am able to see the value i have seleted from GridView, and i have to use this variable to some other method, when i removed the alert method than i am not able to get the selected value. if i add alert method than its works fine. and i have set " immediate="true" " of hiddenvariable in JSF.
please let me know what is causing this problem.
thanks in advance.
dayananda b v
HI,
i guess the hidden variable is not updated, and if put alert message i hope it will take some time to display and click ok, so in the mean time the hidden variable getting update. if this is case what could be answer.
Hi, dayanandabv!
I'm affraid that the information send is not enough for me to reproduce the scenario. I'll try to think of some solution if you provide me with more detailed information, e.g. parts of your source code and also an explanation of what the idea of this hidden variable is.
Regards!
--Bozhidar
sorry, i tried like that only, but the alert is not coming up,
this.selectRow=function(domNode,select){ var row=this.getTargetRow(domNode); if(!ig.isNull(row)){if(select){row.select();} else{row.unselect();} var grid=this.getGrid(domNode);if(!ig.isNull(grid)&&grid.isImmediateRowsChangeEvent()){
ig.smartSubmit(grid.elm.id,null,null, null, this.customFLT);}}};
this.customFLT=function(){ alert("Hello”); // alert("Hidden Field = " + parent.frames.document.getElementById("form1:hiddenField1").value);
var arraystr= parent.frames.document.getElementById("form1:hiddenField1").value; // here i am calling applet method pasing the value of arraystr,
};
You don't get the 'Hello'-alert? With me it was working.
Hi Bozhidar,
Thanks for quick replays
sorry i am not getting any "Hello" alert message, i have tried in different combination. Is it the correct place what i placed the code i.e. “ig.smartSubmit(grid.elm.id,null,null, null, this.customFLT);}}};” please let me know from end of I have three bracket,(”}}}”) is that correct,
and I have tried like this also,
“ig.smartSubmit(grid.elm.id,null,null); ig.smartSubmit(grid.elm.id,null,null, null, this.customFLT);}}};”
It’ s giving wired behavior, and I have tried like this also
“ig.smartSubmit(grid.elm.id,null,null); }} ig.smartSubmit(grid.elm.id,null,null, null, this.customFLT);};”
It is also giving wired behavior
Thanks
Daynanda B V
this is the code that I added to the igf_grid.js file.
// customer code
var row=this.getTargetRow(domNode);
else{row.unselect();}
alert("Hello");
// alert("Hidden Field = " + parent.frames.document.getElementById("form1:hiddenField1").value);
// here i am calling applet method pasing the value of arraystr,
// customer code END
i am really sorry, the "Hello" alert message is coming, actually alert message is inside the if condition, and i am checking hidden variable value for null condition (meaning it as some value or not), but i am getting the hidden variable value as blank(null value), because if the reason it is not going inside the if condition. and i have checked in tomcat console, the value for hidden variable i am setting which is showing correctly.
alert(parent.frames.application_left.document.getElementById("form1:hiddenField1").value); // here I am not(blank) getting the value.
What could be reason for this.
thanks
dayananda B V
I will now apply all my source code:
JAVA BackingBean:
GridView grid;
List clientsList = DAO.getClientsList(); // adding some objects
HtmlInputHidden hiddenField1;
}
public void onChangeSelection(SelectedRowsChangeEvent e) {
String selectedid = "";
if (getGrid() != null) {
Iterator selectedRows = getGrid().getSelectedRows()
.iterator();
while (selectedRows.hasNext()) {
RowItem rowItem = (RowItem) selectedRows.next();
{
int i = 0;
Iterator iter = (Iterator) rowItem.getCells().iterator();
while (iter.hasNext()) {
UIComponent cell = (UIComponent) iter.next();
Object object = cell.getChildren().get(0);
if (object instanceof UIOutput) {
if (i == 0) {
String selectedUnit = ((UIOutput) object)
.getValue().toString();
selectedid = selectedid + selectedUnit;
i++;
getHiddenField1().setValue(selectedid);
SmartRefreshManager srm = SmartRefreshManager.getCurrentInstance();
srm.removeSmartRefreshIds(getHiddenField1().getClientId(
FacesContext.getCurrentInstance()));
srm.addSmartRefreshId(getHiddenField1().getClientId(
getHiddenField1().setImmediate(true);
System.out.println("getHiddenField1---> "
+ getHiddenField1().getValue());
public GridView getGrid() {
return grid;
public void setGrid(GridView grid) {
this.grid = grid;
public List getClientsList() {
return clientsList;
public void setClientsList(List clientsList) {
this.clientsList = clientsList;
public HtmlInputHidden getHiddenField1() {
return hiddenField1;
public void setHiddenField1(HtmlInputHidden hiddenField1) {
this.hiddenField1 = hiddenField1;
JSP page:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="ig"
uri="http://es.infragistics.com/faces/netadvantage"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<f:view>
<h:form id="form1">
<ig:gridView id="grid"
dataSource="#{webGridSelectionBean.clientsList}" pageSize="10"
pageChangeListener="#{webGridSelectionBean.onPageChange}"
dataKeyName="id"
selectedRowsChangeListener="#{webGridSelectionBean.onChangeSelection}"
binding="#{webGridSelectionBean.grid}">
<f:facet name="header">
<h:outputText value="Clients List"></h:outputText>
</f:facet>
<ig:columnSelectRow showSelectAll="true"></ig:columnSelectRow>
<ig:column>
<h:outputText value="Client Id"></h:outputText>
<h:outputText value="#{DATA_ROW.id}"></h:outputText>
</ig:column>
<h:outputText value="Company"></h:outputText>
<h:outputText value="#{DATA_ROW.companyName}"></h:outputText>
<h:outputText value="Reg. number"></h:outputText>
<h:outputText value="#{DATA_ROW.regNumber}"></h:outputText>
<h:outputText value="Selected"></h:outputText>
<h:outputText value="#{DATA_ROW.selected}"></h:outputText>
</ig:gridView>
< <h:inputHidden binding="#{webGridSelectionBean.hiddenField1}"
id="hiddenField1" immediate="true"></h:inputHidden>
<table>
<tr>
<td><h:outputText id="messOnPage"
value="#{webGridSelectionBean.msgRowsOnPage}"
binding="#{webGridSelectionBean.textRowsNoPage}"></h:outputText></td>
</tr>
<td><h:outputText id="messSelected"
value="#{webGridSelectionBean.msgRowsSelected}"
binding="#{webGridSelectionBean.textRowsSelected}"></h:outputText></td>
</table>
</h:form>
</f:view>
</body>
</html>
Changes in igf_grid.js:
Replace the following code
var row = this.getTargetRow(domNode);
row.select();
row.unselect();
if (!ig.isNull(grid) && grid.isImmediateRowsChangeEvent()) {
this.selectRow = function(domNode, select) {
if (!ig.isNull(row)) {
ig.onPartialRefreshDefault(httpReq);
Please, for further help consult our support policies. Thanks in advance!
HI Bozhidar,
as i am not doing any mistake, let me compare with your demo code.
can you please send your demo code to my mail id or you can just add it here, or shall i send all the nessarry files to you?