Return a grid value from another grid Value
Hi everybody, I'm trying to develope a webpage where anyone can buy my products. My problem is focused on the grid where the client has to add or delete the items they will buy. I've written some code where y can do the follow:
<style>
.aw-mouseover-cell {background: #def;}
.aw-item-indicator {
display: none; /* hidden by default */
position: absolute;
overflow: hidden;
right: 2px;
top: 2px;
width: 8px;
height: 8px;
background: red;
cursor: pointer;
}
.aw-indicator-visible .aw-item-indicator {
display: block; /* visible */
}
</style>
<script>
// new cell template class
var MyTemplate = AW.Templates.Text.subclass();
MyTemplate.create = function(){
var obj = this.prototype;
// hides/shows indicator depending on cell/indicator poperty
obj.setClass("indicator", function(){
return this.getControlProperty("indicator") ? "visible" : "hidden";
});
// indicator span element
var indicator = new AW.HTML.SPAN;
indicator.setClass("item", "indicator");
indicator.setEvent("onclick", function(){
this.raiseEvent("onCellIndicatorClicked");
});
obj.setContent("box/indicator", indicator);
}
var string = new AW.Formats.String;
var number = new AW.Formats.Number;
number.setTextFormat("#,###.##");
// var obj = new AW.UI.Grid;
var obj = new AW.Grid.Extended;
obj.setSize(980, 200);
// obj.setCellText(function(i, j){return j + "-" + i});
obj.setSelectorVisible(true);
obj.setSelectorWidth(25);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setHeaderText("Cod. Artículo", 0);
obj.setHeaderText("Detalle", 1);
obj.setColumnWidth(200, 1);
obj.setHeaderText("Precio", 2);
obj.setColumnWidth(80, 2);
obj.setHeaderText("Desc. Gral.", 3);
obj.setColumnWidth(80, 3);
obj.setHeaderText("Desc. Esp.", 4);
obj.setColumnWidth(80, 4);
obj.setHeaderText("Desc. Part.", 5);
obj.setColumnWidth(80, 5);
obj.setHeaderText("Oferta", 6);
obj.setColumnWidth(80, 6);
obj.setHeaderText("Bonif.(%)", 7);
obj.setColumnWidth(80, 7);
obj.setHeaderText("I.V.A.", 8);
obj.setColumnWidth(80, 8);
obj.setHeaderText("Importe", 9);
obj.setColumnWidth(80, 9);
// obj.setCellFormat([string, string, number, number, number, number, number, number, number, number, number,]);
obj.setColumnCount(10);
obj.setRowCount(0);
obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("Ingrese Artículo", 0, row);
}
obj.setCellEditable(true);
// new cell property hides/shows indicator sign
obj.defineCellProperty("indicator", false);
// show for cell 1-1
obj.setCellIndicator(true, 0, this.getRowPosition);
// our new template for col-1
obj.setCellTemplate(new MyTemplate, 0);
obj.onCellIndicatorClicked = function(event, col, row){
window.open('ventana.asp', '_blank','width=600,height=400,scrollbars=no');
};
document.write(obj);
obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("Ingrese Artículo", 0, row);
}
// obj.onRowDeleting = function(row){
// return !confirm("Delete row " + row+1 + "?");
// }
// obj.onRowDeleted = function(row){
// window.status = "Row deleted: " + row;
// }
// row index
var serial = 0;
function add(){
obj.addRow(serial++);
}
function del(){
var i = obj.getCurrentRow();
obj.deleteRow(i);
}
function GuardaTransaccion(){
if (confirm("¿Confirma la Transacción?")) {
confirm("Ha Aceptado la Transacción");
function(i, j){return j + "-" + i}
}
else confirm("Ha Cancelado la Transacción");
}
</script>
As you can see, in the first column i've placed an Indicator that opens a new asp page where i execute a query to my SQL 2000 Database. What i need is to write some code that let me return the selection that i choose from that new asp to the cell i clicked. I've been looking for some info at the internet but i just don´t get to undertnad it well. If any of you can help me i'll appreciate your answer. Saludos from Argentina.
<style>
.aw-mouseover-cell {background: #def;}
.aw-item-indicator {
display: none; /* hidden by default */
position: absolute;
overflow: hidden;
right: 2px;
top: 2px;
width: 8px;
height: 8px;
background: red;
cursor: pointer;
}
.aw-indicator-visible .aw-item-indicator {
display: block; /* visible */
}
</style>
<script>
// new cell template class
var MyTemplate = AW.Templates.Text.subclass();
MyTemplate.create = function(){
var obj = this.prototype;
// hides/shows indicator depending on cell/indicator poperty
obj.setClass("indicator", function(){
return this.getControlProperty("indicator") ? "visible" : "hidden";
});
// indicator span element
var indicator = new AW.HTML.SPAN;
indicator.setClass("item", "indicator");
indicator.setEvent("onclick", function(){
this.raiseEvent("onCellIndicatorClicked");
});
obj.setContent("box/indicator", indicator);
}
var string = new AW.Formats.String;
var number = new AW.Formats.Number;
number.setTextFormat("#,###.##");
// var obj = new AW.UI.Grid;
var obj = new AW.Grid.Extended;
obj.setSize(980, 200);
// obj.setCellText(function(i, j){return j + "-" + i});
obj.setSelectorVisible(true);
obj.setSelectorWidth(25);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});
obj.setHeaderText("Cod. Artículo", 0);
obj.setHeaderText("Detalle", 1);
obj.setColumnWidth(200, 1);
obj.setHeaderText("Precio", 2);
obj.setColumnWidth(80, 2);
obj.setHeaderText("Desc. Gral.", 3);
obj.setColumnWidth(80, 3);
obj.setHeaderText("Desc. Esp.", 4);
obj.setColumnWidth(80, 4);
obj.setHeaderText("Desc. Part.", 5);
obj.setColumnWidth(80, 5);
obj.setHeaderText("Oferta", 6);
obj.setColumnWidth(80, 6);
obj.setHeaderText("Bonif.(%)", 7);
obj.setColumnWidth(80, 7);
obj.setHeaderText("I.V.A.", 8);
obj.setColumnWidth(80, 8);
obj.setHeaderText("Importe", 9);
obj.setColumnWidth(80, 9);
// obj.setCellFormat([string, string, number, number, number, number, number, number, number, number, number,]);
obj.setColumnCount(10);
obj.setRowCount(0);
obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("Ingrese Artículo", 0, row);
}
obj.setCellEditable(true);
// new cell property hides/shows indicator sign
obj.defineCellProperty("indicator", false);
// show for cell 1-1
obj.setCellIndicator(true, 0, this.getRowPosition);
// our new template for col-1
obj.setCellTemplate(new MyTemplate, 0);
obj.onCellIndicatorClicked = function(event, col, row){
window.open('ventana.asp', '_blank','width=600,height=400,scrollbars=no');
};
document.write(obj);
obj.onRowAdded = function(row){
window.status = "Row added: " + row;
this.setCellText("Ingrese Artículo", 0, row);
}
// obj.onRowDeleting = function(row){
// return !confirm("Delete row " + row+1 + "?");
// }
// obj.onRowDeleted = function(row){
// window.status = "Row deleted: " + row;
// }
// row index
var serial = 0;
function add(){
obj.addRow(serial++);
}
function del(){
var i = obj.getCurrentRow();
obj.deleteRow(i);
}
function GuardaTransaccion(){
if (confirm("¿Confirma la Transacción?")) {
confirm("Ha Aceptado la Transacción");
function(i, j){return j + "-" + i}
}
else confirm("Ha Cancelado la Transacción");
}
</script>
As you can see, in the first column i've placed an Indicator that opens a new asp page where i execute a query to my SQL 2000 Database. What i need is to write some code that let me return the selection that i choose from that new asp to the cell i clicked. I've been looking for some info at the internet but i just don´t get to undertnad it well. If any of you can help me i'll appreciate your answer. Saludos from Argentina.
Marcos Guardia
January 15,