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.descendants().each(function(cell){
- cell.enableOnclickElement();
- cell.contentShowed = false;
- });
- });
- }
- else{
- var current_row = this.element.up('tr');
- alert(current_row.id);
- current_row.descendants().each(function(cell){
- alert(cell.behavior);
- cell.behavior.contentShowed = true;
- });
- this.element.up("tbody").select("tr.dynamic-line").each(function(line){
- line.addClassName("disable");
- line.descendants().each(function(cell){
- cell.disableOnclickElement();
- });
- });
- 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;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement