3.2.0

After combo changed, lock another cell

I have bougth the license of ActiveWidgets and have been have one problem with the combo box into the grid. The grid was work correctly, but after i changed any options, the focus has locked into this cell and i couldn't click above any cells.

Here my sourcecode of grid settings:

var myHeaders = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11","12"];
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
obj.setControlSize(770, 280);
obj.setCellText(myData);
obj.setCellEditable(true);
obj.setHeaderCount(1);
obj.setHeaderText(myHeaders);
obj.setColumnCount(12);
obj.setRowCount(myLines);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectionMode("single-cell");

Please, someone may help me ?
Daniel (daniel@marsilink.com.br)
December 12,
Daniel,

I don't see the combo box in this code. Can you publish full sample?
Alex (ActiveWidgets)
December 12,
Ok Alex,

Follow my code:

function carregaGrid() {
var myData = [
<%


int valAux = -1;
java.math.BigDecimal VAZIO = new java.math.BigDecimal(String.valueOf(valAux));
if (request.getSession(true).getAttribute("GeraDadosGridAtrib") != null) {
ArrayList lista = (ArrayList) request.getSession(true).getAttribute("GeraDadosGridAtrib");

for (int i=0; i < lista.size(); i++) {
ResumoEdicaoBean resumo = (ResumoEdicaoBean) lista.get(i);

if ((resumo.getCod_anunciante() != null &&
resumo.getCod_anunciante() != VAZIO) &&
(resumo.getNum_documento_anunciante() != null &&
!resumo.getNum_documento_anunciante().trim().equalsIgnoreCase("NULO"))) {
resumo.setNom_razao_social_anunciante (
new RetornaDescricao().consultaOraclePessoa
(request,
resumo.getCod_anunciante().toString(),
resumo.getNum_documento_anunciante().toString(),
"",
""));
acao = resumo.getDes_salvar();

} else {
resumo.setNom_razao_social_anunciante ("");
}

%>
[
"<%=resumo.getNom_razao_social_anunciante() == null ? "" : resumo.getNom_razao_social_anunciante() %>",
"<%=resumo.getCod_pi() == null ? "" : resumo.getCod_pi() %>",
"<%=resumo.getNum_documento_anunciante() == null ? "" : Rotinas.retornaFormatacaoCNPJ(resumo.getNum_documento_anunciante()) %>",
"<%=resumo.getNom_contato() == null ? "" : resumo.getNom_contato() %>",
"<%=resumo.getDes_marca() == null ? "" : resumo.getDes_marca() %>",
"<%=resumo.getDes_material() == null ? "" : resumo.getDes_material() %>",
"<%=resumo.getDes_espaco() == null ? "" : resumo.getDes_espaco() %>",
"<%=resumo.getDes_posicao() == null ? "" : resumo.getDes_posicao() %>",
"<%=resumo.getDes_titulo() == null ? "" : resumo.getDes_titulo() %>",
"<%=resumo.getDes_pagina() == null ? "" : resumo.getDes_pagina() %>",
"<%=resumo.getDes_multipage() == null ? "" : resumo.getDes_multipage() %>",
"<%=resumo.getDes_obs_material() == null ? "" : resumo.getDes_obs_material() %>",
],
<% } %>
<% } %>
];
var myLines = <%=linhas%>
var myHeaders = ["Anunciante", "PI", "CNPJ", "Contato", "Marca", "Material", "Espaço", "Posição", "Título", "Página", "Multipage","Obs.Material"];
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
obj.setControlSize(770, 280); // width, height
obj.setCellText(myData);
obj.setCellEditable(true); // enable editing
obj.setHeaderCount(1);
obj.setHeaderText(myHeaders);
obj.setColumnCount(12);
obj.setRowCount(myLines);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectionMode("single-cell");
var tabMaterial = [
<%
if (request.getSession(true).getAttribute("GridMaterialAtrib") != null) {
String saida = "";
ArrayList lista2 = (ArrayList) request.getSession(true).getAttribute("GridMaterialAtrib");
for (int i=0; i < lista2.size(); i++) {
if (lista2.get(i) != null && lista2.get(i) != "") {
saida = lista2.get(i).toString();
} else {
saida = "";
}
if (i == lista2.size()-1) {
%>
"<%=saida%>"
<% } else { %>
"<%=saida%>",
<% } %>
<% } %>
<% } %>
];
var tabPosicao = [
<%
if (request.getSession(true).getAttribute("GridPosicaoAtrib") != null) {
String saida3 = "";
ArrayList lista3 = (ArrayList) request.getSession(true).getAttribute("GridPosicaoAtrib");
for (int i=0; i < lista3.size(); i++) {
if (lista3.get(i) != null && lista3.get(i) != "") {
saida3 = lista3.get(i).toString();
} else {
saida3 = "";
}
if (i == lista3.size()-1) {
%>
"<%=saida3%>"
<% } else { %>
"<%=saida3%>",
<% } %>
<% } %>
<% } %>
];
var tabPagina = [
<%
if (request.getSession(true).getAttribute("GridPaginaAtrib") != null) {
String saida4 = "";
ArrayList lista4 = (ArrayList) request.getSession(true).getAttribute("GridPaginaAtrib");
for (int i=0; i < lista4.size(); i++) {
if (lista4.get(i) != null && lista4.get(i) != "") {
saida4 = lista4.get(i).toString();
} else {
saida4 = "";
}
if (i == lista4.size()-1) {
%>
"<%=saida4%>"
<% } else { %>
"<%=saida4%>",
<% } %>
<% } %>
<% } %>
];
// -------------------------------------------------------------------------------------------
// Combos
// -------------------------------------------------------------------------------------------
obj.setCellTemplate(new AW.Templates.Combo, 5);
obj.setCellTemplate(new AW.Templates.Combo, 7);
obj.setCellTemplate(new AW.Templates.Combo, 9);
obj.setPopupTemplate(function(col, row) {
var list = new AW.UI.List;
if (col==5) {
list.setItemText (tabMaterial);
list.setItemCount(tabMaterial.length);
}
if (col==7) {
list.setItemText (tabPosicao);
list.setItemCount(tabPosicao.length);
}
if (col==9) {
list.setItemText (tabPagina);
list.setItemCount(tabPagina.length);
}
list.onItemClicked = function(event, i) {
var selectedText = this.getItemText(i);
obj.setCellText (selectedText, col, row);
obj.setCellValue(selectedText, col, row);
obj.getCellTemplate(col, row).hidePopup();
obj.refresh();
}
return list;
});
obj.onCellValueChanged = function(value, col, row){
var str = tabMaterial.valueOf(value);
if (col == 5) {
this.setCellText(value, 5, row); // show last new value in first col (c0)
}
}
document.write(obj);

var obj2 = new AW.UI.Button;
obj2.setControlText("Salvar Grid");
document.write(obj2);
obj2.onControlClicked = function(event){
var csvString = ""
var cont = 0;
for ( var i=0; i < obj.getRowCount(); i++) {
for ( var j=0; j < obj.getColumnCount(); j++) {
var valor = obj.getCellValue(j,i);
if (valor != undefined ||
valor != null ||
valor != "" ||
!valor.equals("undefined")) {
if ((obj.getCellValue(0,i) != "" && obj.getCellValue(0,i) != null) &&
(obj.getCellValue(1,i) != "" && obj.getCellValue(1,i) != null)) {
//if (valor.length == 0) {
// csvString += "NULO" + ";";
//} else {
csvString += valor + ";";
//}
}
}
} // for
if ((obj.getCellValue(0,i) != "" && obj.getCellValue(0,i) != null) &&
(obj.getCellValue(1,i) != "" && obj.getCellValue(1,i) != null)) {
//if (valor.length == 0) {
// csvString += "NULO" + "#";
//} else {
csvString += valor + "#";
cont++;
//}
//csvString += "#";
}
} // for
csvString = cont + "#" + csvString;
document.getElementById("csvHiddenData").value = csvString;
document.formulario.parametro.value += " anu.cod_produto = '"+document.formulario.cod_produto.value+"' AND edi.num_edicao = '"+document.formulario.num_edicao.value+"'";
document.formulario.numOpcao.value = "823";
document.formulario.acao.value = "trtw0000";
document.formulario.submit();
//alert("Registros gravados com sucesso !!!");
}

var obj2_update = new AW.UI.Button;
obj2_update.setControlText("Atualizar Grid");
document.write(obj2_update);
obj2_update.onControlClicked = function(event){
var myParam = [

];
var myCodProduto = '<%=codProduto%>';
var myNumEdicao = '<%=numEdicao%>';
consultaDetalhada(myCodProduto,myNumEdicao);
}
var obj2_back = new AW.UI.Button;
obj2_back.setControlText("Voltar");
document.write(obj2_back);
obj2_back.onControlClicked = function(event){
document.formulario.numOpcao.value = "824";
document.formulario.acao.value = "trtw0000";
document.formulario.submit();
}
/********************************************************************
A C T I O N S / E V E N T S
********************************************************************/
obj.onCellClicked = function(event, column, row){ window.status = "Cell " + column + "." + row + " clicked"};
obj.onCellDoubleClicked = function(event, column, row){ window.status = "Cell " + column + "." + row + " double clicked"};
obj.onCellMouseOver = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse over"};
obj.onCellMouseOut = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse out"};
obj.onCellMouseDown = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse down"};
obj.onCellMouseUp = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse up"};
obj.onHeaderClicked = function(event, index) { window.status = "Header " + index + " clicked"};
obj.onHeaderDoubleClicked = function(event, index) { window.status = "Header " + index + " double clicked"};
obj.onHeaderMouseOver = function(event, index) { window.status = "Header " + index + " mouse over"};
obj.onHeaderMouseOut = function(event, index) { window.status = "Header " + index + " mouse out"};
obj.onHeaderMouseDown = function(event, index) { window.status = "Header " + index + " mouse down"};
obj.onHeaderMouseUp = function(event, index) { window.status = "Header " + index + " mouse up"};
obj.onFooterClicked = function(event, index) { window.status = "Footer " + index + " clicked"};
obj.onFooterDoubleClicked = function(event, index) { window.status = "Footer " + index + " double clicked"};
obj.onFooterMouseOver = function(event, index) { window.status = "Footer " + index + " mouse over"};
obj.onFooterMouseOut = function(event, index) { window.status = "Footer " + index + " mouse out"};
obj.onFooterMouseDown = function(event, index) { window.status = "Footer " + index + " mouse down"};
obj.onFooterMouseUp = function(event, index) { window.status = "Footer " + index + " mouse up"};
obj.onSelectorClicked = function(event, index) { window.status = "Selector " + index + " clicked"};
obj.onSelectorDoubleClicked = function(event, index) { window.status = "Selector " + index + " double clicked"};
obj.onSelectorMouseOver = function(event, index) { window.status = "Selector " + index + " mouse over"};
obj.onSelectorMouseOut = function(event, index) { window.status = "Selector " + index + " mouse out"};
obj.onSelectorMouseDown = function(event, index) { window.status = "Selector " + index + " mouse down"};
obj.onSelectorMouseUp = function(event, index) { window.status = "Selector " + index + " mouse up"};
obj.onCurrentColumnChanged = function(index) { window.status = "current column: " + index };
return true;
}


thanks...
Daniel (daniel@marsilink.com.br)
December 13,
Daniel,
I guess your sample is locked by the line
obj.onCellValueChanged = function(value, col, row){
try to change it to:
obj.onCellEditEnded = function(value, col, row){
HTH
Carlos
December 14,
Thanks Carlos...
I Tried this option and doesn't work again.
Please, look my code and tell me if you get another fail...

There's another problem. My grid show 15 rows and when i run the grid with a lot of rows, after change any combo, the lines than was out of screen desapear, leaving this rows blank.

Please, someone can help me.

Thanks

Daniel (daniel.marsili@folha.com.br)

*** SOurce COde ***

function carregaGrid() {
var myData = [
<%


int valAux = -1;
java.math.BigDecimal VAZIO = new java.math.BigDecimal(String.valueOf(valAux));
if (request.getSession(true).getAttribute("GeraDadosGridAtrib") != null) {
ArrayList lista = (ArrayList) request.getSession(true).getAttribute("GeraDadosGridAtrib");

for (int i=0; i < lista.size(); i++) {
ResumoEdicaoBean resumo = (ResumoEdicaoBean) lista.get(i);

if ((resumo.getCod_anunciante() != null &&
resumo.getCod_anunciante() != VAZIO) &&
(resumo.getNum_documento_anunciante() != null &&
!resumo.getNum_documento_anunciante().trim().equalsIgnoreCase("NULO"))) {
resumo.setNom_razao_social_anunciante (
new RetornaDescricao().consultaOraclePessoa
(request,
resumo.getCod_anunciante().toString(),
resumo.getNum_documento_anunciante().toString(),
"",
""));
acao = resumo.getDes_salvar();

} else {
resumo.setNom_razao_social_anunciante ("");
}

%>
[
"<%=resumo.getNom_razao_social_anunciante() == null ? "" : resumo.getNom_razao_social_anunciante() %>",
"<%=resumo.getCod_pi() == null ? "" : resumo.getCod_pi() %>",
"<%=resumo.getNum_documento_anunciante() == null ? "" : Rotinas.retornaFormatacaoCNPJ(resumo.getNum_documento_anunciante()) %>",
"<%=resumo.getNom_contato() == null ? "" : resumo.getNom_contato() %>",
"<%=resumo.getDes_marca() == null ? "" : resumo.getDes_marca() %>",
"<%=resumo.getDes_material() == null ? "" : resumo.getDes_material() %>",
"<%=resumo.getDes_espaco() == null ? "" : resumo.getDes_espaco() %>",
"<%=resumo.getDes_posicao() == null ? "" : resumo.getDes_posicao() %>",
"<%=resumo.getDes_titulo() == null ? "" : resumo.getDes_titulo() %>",
"<%=resumo.getDes_pagina() == null ? "" : resumo.getDes_pagina() %>",
"<%=resumo.getDes_multipage() == null ? "" : resumo.getDes_multipage() %>",
"<%=resumo.getDes_obs_material() == null ? "" : resumo.getDes_obs_material() %>",
],
<% } %>
<% } %>
];
var myLines = <%=linhas%>
var myHeaders = ["Anunciante", "PI", "CNPJ", "Contato", "Marca", "Material", "Espaço", "Posição", "Título", "Página", "Multipage","Obs.Material"];
var obj = new AW.Grid.Extended;
obj.setId("myGrid");
obj.setControlSize(770, 280); // width, height
obj.setCellText(myData);
obj.setCellEditable(true); // enable editing
obj.setHeaderCount(1);
obj.setHeaderText(myHeaders);
obj.setColumnCount(12);
obj.setRowCount(myLines);
obj.setSelectorVisible(true);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setSelectionMode("single-cell");
var tabMaterial = [
<%
if (request.getSession(true).getAttribute("GridMaterialAtrib") != null) {
String saida = "";
ArrayList lista2 = (ArrayList) request.getSession(true).getAttribute("GridMaterialAtrib");
for (int i=0; i < lista2.size(); i++) {
if (lista2.get(i) != null && lista2.get(i) != "") {
saida = lista2.get(i).toString();
} else {
saida = "";
}
if (i == lista2.size()-1) {
%>
"<%=saida%>"
<% } else { %>
"<%=saida%>",
<% } %>
<% } %>
<% } %>
];
var tabPosicao = [
<%
if (request.getSession(true).getAttribute("GridPosicaoAtrib") != null) {
String saida3 = "";
ArrayList lista3 = (ArrayList) request.getSession(true).getAttribute("GridPosicaoAtrib");
for (int i=0; i < lista3.size(); i++) {
if (lista3.get(i) != null && lista3.get(i) != "") {
saida3 = lista3.get(i).toString();
} else {
saida3 = "";
}
if (i == lista3.size()-1) {
%>
"<%=saida3%>"
<% } else { %>
"<%=saida3%>",
<% } %>
<% } %>
<% } %>
];
var tabPagina = [
<%
if (request.getSession(true).getAttribute("GridPaginaAtrib") != null) {
String saida4 = "";
ArrayList lista4 = (ArrayList) request.getSession(true).getAttribute("GridPaginaAtrib");
for (int i=0; i < lista4.size(); i++) {
if (lista4.get(i) != null && lista4.get(i) != "") {
saida4 = lista4.get(i).toString();
} else {
saida4 = "";
}
if (i == lista4.size()-1) {
%>
"<%=saida4%>"
<% } else { %>
"<%=saida4%>",
<% } %>
<% } %>
<% } %>
];
// -------------------------------------------------------------------------------------------
// Combos
// -------------------------------------------------------------------------------------------
obj.setCellTemplate(new AW.Templates.Combo, 5);
obj.setCellTemplate(new AW.Templates.Combo, 7);
obj.setCellTemplate(new AW.Templates.Combo, 9);
obj.setPopupTemplate(function(col, row) {
var list = new AW.UI.List;
if (col==5) {
list.setItemText (tabMaterial);
list.setItemCount(tabMaterial.length);
}
if (col==7) {
list.setItemText (tabPosicao);
list.setItemCount(tabPosicao.length);
}
if (col==9) {
list.setItemText (tabPagina);
list.setItemCount(tabPagina.length);
}
list.onItemClicked = function(event, i) {
var selectedText = this.getItemText(i);
obj.setCellText (selectedText, col, row);
obj.setCellValue(selectedText, col, row);
obj.getCellTemplate(col, row).hidePopup();
obj.refresh();
}
return list;
});
/*
* Update for test.
*
*/
obj.onCellEditEnded = function(value, col, row){
var str = tabMaterial.valueOf(value);
if (col == 5) {
this.setCellText(value, 5, row); // show last new value in first col (c0)
}
}
/*obj.onCellValueChanged = function(value, col, row){
var str = tabMaterial.valueOf(value);
if (col == 5) {
this.setCellText(value, 5, row); // show last new value in first col (c0)
}
} */
document.write(obj);

var obj2 = new AW.UI.Button;
obj2.setControlText("Salvar Grid");
document.write(obj2);
obj2.onControlClicked = function(event){
var csvString = ""
var cont = 0;
for ( var i=0; i < obj.getRowCount(); i++) {
for ( var j=0; j < obj.getColumnCount(); j++) {
var valor = obj.getCellValue(j,i);
if (valor != undefined ||
valor != null ||
valor != "" ||
!valor.equals("undefined")) {
if ((obj.getCellValue(0,i) != "" && obj.getCellValue(0,i) != null) &&
(obj.getCellValue(1,i) != "" && obj.getCellValue(1,i) != null)) {
//if (valor.length == 0) {
// csvString += "NULO" + ";";
//} else {
csvString += valor + ";";
//}
}
}
} // for
if ((obj.getCellValue(0,i) != "" && obj.getCellValue(0,i) != null) &&
(obj.getCellValue(1,i) != "" && obj.getCellValue(1,i) != null)) {
//if (valor.length == 0) {
// csvString += "NULO" + "#";
//} else {
csvString += valor + "#";
cont++;
//}
//csvString += "#";
}
} // for
csvString = cont + "#" + csvString;
document.getElementById("csvHiddenData").value = csvString;
document.formulario.parametro.value += " anu.cod_produto = '"+document.formulario.cod_produto.value+"' AND edi.num_edicao = '"+document.formulario.num_edicao.value+"'";
document.formulario.numOpcao.value = "823";
document.formulario.acao.value = "trtw0000";
document.formulario.submit();
//alert("Registros gravados com sucesso !!!");
}

var obj2_update = new AW.UI.Button;
obj2_update.setControlText("Atualizar Grid");
document.write(obj2_update);
obj2_update.onControlClicked = function(event){
var myParam = [

];
var myCodProduto = '<%=codProduto%>';
var myNumEdicao = '<%=numEdicao%>';
consultaDetalhada(myCodProduto,myNumEdicao);
}
var obj2_back = new AW.UI.Button;
obj2_back.setControlText("Voltar");
document.write(obj2_back);
obj2_back.onControlClicked = function(event){
document.formulario.numOpcao.value = "824";
document.formulario.acao.value = "trtw0000";
document.formulario.submit();
}
/********************************************************************
A C T I O N S / E V E N T S
********************************************************************/
obj.onCellClicked = function(event, column, row){ window.status = "Cell " + column + "." + row + " clicked"};
obj.onCellDoubleClicked = function(event, column, row){ window.status = "Cell " + column + "." + row + " double clicked"};
obj.onCellMouseOver = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse over"};
obj.onCellMouseOut = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse out"};
obj.onCellMouseDown = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse down"};
obj.onCellMouseUp = function(event, column, row){ window.status = "Cell " + column + "." + row + " mouse up"};
obj.onHeaderClicked = function(event, index) { window.status = "Header " + index + " clicked"};
obj.onHeaderDoubleClicked = function(event, index) { window.status = "Header " + index + " double clicked"};
obj.onHeaderMouseOver = function(event, index) { window.status = "Header " + index + " mouse over"};
obj.onHeaderMouseOut = function(event, index) { window.status = "Header " + index + " mouse out"};
obj.onHeaderMouseDown = function(event, index) { window.status = "Header " + index + " mouse down"};
obj.onHeaderMouseUp = function(event, index) { window.status = "Header " + index + " mouse up"};
obj.onFooterClicked = function(event, index) { window.status = "Footer " + index + " clicked"};
obj.onFooterDoubleClicked = function(event, index) { window.status = "Footer " + index + " double clicked"};
obj.onFooterMouseOver = function(event, index) { window.status = "Footer " + index + " mouse over"};
obj.onFooterMouseOut = function(event, index) { window.status = "Footer " + index + " mouse out"};
obj.onFooterMouseDown = function(event, index) { window.status = "Footer " + index + " mouse down"};
obj.onFooterMouseUp = function(event, index) { window.status = "Footer " + index + " mouse up"};
obj.onSelectorClicked = function(event, index) { window.status = "Selector " + index + " clicked"};
obj.onSelectorDoubleClicked = function(event, index) { window.status = "Selector " + index + " double clicked"};
obj.onSelectorMouseOver = function(event, index) { window.status = "Selector " + index + " mouse over"};
obj.onSelectorMouseOut = function(event, index) { window.status = "Selector " + index + " mouse out"};
obj.onSelectorMouseDown = function(event, index) { window.status = "Selector " + index + " mouse down"};
obj.onSelectorMouseUp = function(event, index) { window.status = "Selector " + index + " mouse up"};
obj.onCurrentColumnChanged = function(index) { window.status = "current column: " + index };
return true;
}
Daniel (daniel.marsili@folha.com.br)
December 17,
Daniel, will be nice if you post only the generated javascript, the server-side code just SPAM your code.
Paulo Cesar (PC from Brazil )
December 17,
Hello Mr.s,

I think so that my problems with combo are the same fail.
I changed the "obj.onCellValueChanged" by "obj.onCellEditEnded" and doesn't work.
When i run the grid, after change any combo, lock the focus into this combo and when i move the scrollbar to show another rows, there isn't any data into any cells.

Follow my code:

obj.setCellTemplate(new AW.Templates.Combo, 5);
obj.setCellTemplate(new AW.Templates.Combo, 7);
obj.setCellTemplate(new AW.Templates.Combo, 9);
obj.setPopupTemplate(function(col, row) {
var list = new AW.UI.List;
if (col==5) {
list.setItemText (tabMaterial);
list.setItemCount(tabMaterial.length);
}
if (col==7) {
list.setItemText (tabPosicao);
list.setItemCount(tabPosicao.length);
}
if (col==9) {
list.setItemText (tabPagina);
list.setItemCount(tabPagina.length);
}
list.onItemClicked = function(event, i) {
var selectedText = this.getItemText(i);
obj.setCellText (selectedText, col, row);
obj.setCellValue(selectedText, col, row);
obj.getCellTemplate(col, row).hidePopup();
obj.refresh();
}
return list;
});
obj.onCellEditEnded = function(value, col, row){
var str = tabMaterial.valueOf(value);
if (col == 5) {
this.setCellText(value, 5, row); // show last new value in first col (c0)
}
}
/*obj.onCellValueChanged = function(value, col, row){
var str = tabMaterial.valueOf(value);
if (col == 5) {
this.setCellText(value, 5, row); // show last new value in first col (c0)
}
} */
document.write(obj);


Thanks for help

Regards

Daniel
Daniel (daniel.marsili@folha.com.br)
December 17,
Daniel, not sure if this is what you're intend to do, but try this way.
( two list objects are needed)
I never use combos in cells, so not sure if this is the correct usage,
Anyone using diferent combo-conditional changes??
HTH
var obj = new AW.UI.Grid;   
obj.setId('Myobj');   
obj.setCellText(function(i, j){return j + "-" + i}); 
obj.setCellValue(function(i, j){return j + "-" + i});  
obj.setHeaderText(function(i){return i}); 
obj.setRowCount(100);   
obj.setColumnCount(4);   
obj.setControlSize(500, 200);

obj.setCellTemplate(new AW.Templates.Combo, 1); 
obj.setCellTemplate(new AW.Templates.Combo, 3); 
obj.setPopupTemplate(function(col, row) {

if (col==1) { 
var list1 = new AW.UI.List;
list1.setItemText (['col-1-1','col-1-2','col-1-3']); 
list1.setItemCount(3);
 list1.onItemClicked = function(event, i) {
var selectedText = this.getItemText(i);
obj.setCellText (selectedText, col, row);
obj.setCellValue(selectedText, col, row); 
obj.getCellTemplate(col, row).hidePopup();
obj.setCellText(obj.getCellText(3,row), 0, row); // show last new value in first col (c0)
}
return list1;
}

if (col==3) { 
var list2 = new AW.UI.List;
list2.setItemText (['col-3-1','col-3-2','col-3-3']); 
list2.setItemCount(3); 

 list2.onItemClicked = function(event, i) {
var selectedText = this.getItemText(i);
obj.setCellText (selectedText, col, row);
obj.setCellValue(selectedText, col, row); 
obj.getCellTemplate(col, row).hidePopup();
}
return list2;
}
}); 
document.write(obj);
Carlos
December 19,
Daniel,

I would suggest replacing the popup function with three static list objects -

obj.setCellTemplate(new AW.Templates.Combo, 5);
obj.setCellTemplate(new AW.Templates.Combo, 7);
obj.setCellTemplate(new AW.Templates.Combo, 9);

var list5 = new AW.UI.List;
list5.setItemText (tabMaterial);
list5.setItemCount(tabMaterial.length);
obj.setPopupTemplate(list5, 5);

var list7 = new AW.UI.List;
list7.setItemText (tabPosicao);
list7.setItemCount(tabPosicao.length);
obj.setPopupTemplate(list7, 7);

var list9 = new AW.UI.List;
list9.setItemText (tabPagina);
list9.setItemCount(tabPagina.length);
obj.setPopupTemplate(list9, 9);
Alex (ActiveWidgets)
December 19,

This topic is archived.

See also:


Back to support forum