I have 6 different datatables. I created one massive YUI dialogbox. I need to have different views depending on which datatable is being accessed.
I cant seem to be able to call the function?
do I need more arguments to point to the 'datatable' first and then to point to 'Dialog'?
this is the function
var onDialog = function(oArgs){
var elAnchor = oArgs.target;
var record = this.getRecord(elAnchor);
var column = this.getColumn(elAnchor);
var table=document.getElementById("editDialog");
var thead = table.getElementsByTagName("THEAD")[0];
var tbody = table.getElementsByTagName("TBODY")[0];
var displayStyle;
for (var r = 0; r < tbody.rows.length; r++) {
if ('firsttable') {
//editDialog.setHeader(label = "Edit BU:");
if (tbody.rows[r].id == "editfirstTableRow") {
displayStyle = '';
}else {
displayStyle = 'none';
}
tbody.rows[r].style.display = displayStyle;
document.getElementById("editfirstinput").value = record.getData('name');
}
else if('secondtable') {
// editDialog.setHeader(label = "Edit Header 2:");
if (tbody.rows[r].id == "editsecondTableRow") {
displayStyle = '';
}else {
displayStyle = 'none';
}
tbody.rows[r].style.display = displayStyle;
document.getElementById("editsecondinput").value = record.getData('name');
}
}
editdialog.render();
editdialog.show();
}
}
this is where/how the function is being called
anotherTable is an instance of datatable 'firsttable'
anotherTable.dt.subscribe('linkClickEvent', function(oArgs){
var elAnchor = oArgs.target;
var record = this.getRecord(elAnchor);
var column = this.getColumn(elAnchor);
if (column.key == 'action') {
if (elAnchor.hash.substr(1) == 'edit') {
[B] anotherTable.dt.subscribe('linkClickEvent', onDialog);[/B]
[U]
[B]another2Table is an instance of datatable 'secondtable'[/B][/U]
another2Table.dt.subscribe('linkClickEvent', function(oArgs){
var elAnchor = oArgs.target;
var record = this.getRecord(elAnchor);
var column = this.getColumn(elAnchor);
if (column.key == 'action') {
if (elAnchor.hash.substr(1) == 'edit') {
[B] another2Table.dt.subscribe('linkClickEvent', onDialog);[/B]
}