How to pass the Input Text to Cell Text
Well I am obviously making something wrong, but I am lost a bit and time is pressing me to find sollution... So perhaps I am gonna find some help here... ;-)
I am trying to make a form, to select MySQL columns to be rendered in some Report. I made a grid, that is filled with mysql_fetch_field (PHP) function and added a combo with filtering options ("do not show","=","<",">: etc.). If there is set any other option than "do not show" the next column is changed to input to get the value for filtering.
The point is, that in my example, everything works fine, but the value stored in input field is lost on any operation calling grid.refresh() aka sort etc. I tried to use onControlEditEnded event to set cellText to the value of inputs controlText, but it does not work :(
Here is my code:
TO ALEX: Is it because I call the setTemplate form within othe object and set the input behaviour and properities within that object ?
I am trying to make a form, to select MySQL columns to be rendered in some Report. I made a grid, that is filled with mysql_fetch_field (PHP) function and added a combo with filtering options ("do not show","=","<",">: etc.). If there is set any other option than "do not show" the next column is changed to input to get the value for filtering.
The point is, that in my example, everything works fine, but the value stored in input field is lost on any operation calling grid.refresh() aka sort etc. I tried to use onControlEditEnded event to set cellText to the value of inputs controlText, but it does not work :(
Here is my code:
gridReportTables.setPopupTemplate(function(col, row) {
var grid = this;
var list = new AW.UI.List;
list.setItemText(["Do not show","equals", "is higher than", "is less than","is higher or equals","is less or equals","is between"]);
list.setItemValue([0,1, 2, 3, 4, 5, 6]);
list.setItemCount(7);
for (i = 0; i < list.getItemCount(); i++) {
if (grid.getCellValue(col, row) == list.getItemValue(i)) {
list.setSelectedItems([i]);
break;
}
}
list.onItemClicked = function(event, i){
var text = this.getItemText(i);
var value = this.getItemValue(i);
grid.setCellText(text, col, row);
grid.setCellValue(value, col, row);
grid.getCellTemplate(col, row).hidePopup();
var defaultcelltemplate = grid.getCellTemplate(0,0);
var CellEdit = new AW.UI.Input;
CellEdit.onControlEditEnded = function(col, row)
{
alert(CellEdit.getControlText());
grid.setCellText( this.getControlText(), col, row);
grid.setCellValue( this.getControlValue(), col, row);
}
if(value > 0 && value < 6)
{
grid.setCellTemplate(CellEdit, 14, row);
grid.setCellTemplate(defaultcelltemplate, 15,row);
grid.refresh();
}
else if(value == 6)
{
grid.setCellTemplate(CellEdit, 14,row);
grid.setCellTemplate(CellEdit, 15,row);
grid.refresh();
}
else if(value == 0)
{
grid.setCellTemplate(defaultcelltemplate, 14,row);
grid.setCellTemplate(defaultcelltemplate, 15,row);
grid.refresh();
}
}
return list;
});
TO ALEX: Is it because I call the setTemplate form within othe object and set the input behaviour and properities within that object ?
ASJ
October 16,