Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var DynamicCellBehavior = Behavior.create({
- initialize: function(){
- this.disableClick = false;
- this.disableHover = false;
- this.contentShowed = false;
- this.element.behavior = this;
- },
- onclick: function(event){
- if(this.disableClick){
- alert("Another line is active.\nClose it first to view another line");
- return;
- }
- if(this.contentShowed){
- var current_row = this.element.up('tr');
- alert(current_row.id);
- var details_row = $(current_row.id + '_details');
- details_row.replace('');
- this.element.up("tbody").select("tr.dynamic-line").each(function(line){
- line.removeClassName("disable");
- line.childElements().each(function(cell){
- cell.enableOnclickElement();
- cell.contentShowed = false;
- });
- });
- }
- else{
- var current_row = this.element.up('tr');
- alert(current_row.id);
- current_row.childElements().each(function(cell){
- //alert(cell + ' '+ cell.id);
- if (cell.id != '')
- //alert(cell + ' '+ cell.id + ' ' + cell.classNames());
- cell.element.behavior.showedContent();
- });
- this.element.up("tbody").select("tr.dynamic-line").each(function(line){
- line.addClassName("disable");
- line.childElements().each(function(cell){
- //cell.element.behavior.disableOnclickElement();
- });
- });
- alert(current_row.element.down("a.show-line"));
- //current_row.element.down("a.show-line").onclick();
- }
- },
- disableOnhoverElement: function(){
- this.disableHover = true;
- },
- enableOnhoverElement: function(){
- this.disableHover = false;
- },
- disableOnclickElement: function(){
- this.disableClick = true;
- },
- enableOnclickElement: function(){
- this.disableClick = false;
- },
- showedContent: function(){
- this.contentShowed = true;
- },
- hidedContent: function(){
- this.contentShowed = false;
- },
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement