Changeset 460 for trunk/web-app


Ignore:
Timestamp:
May 25, 2010, 12:06:11 PM (11 years ago)
Author:
duh
Message:
  • fixed issue with the table editor
  • view for grouping page
Location:
trunk/web-app/js
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/web-app/js/table-editor.js

    r359 r460  
    9292        $(this.columnIdentifier, row).each(function() {
    9393            var input = $(':input', $(this));
     94            var inputElement = $(input)
     95            var type = inputElement.attr('type');
    9496
    9597            // does this column contain an input field
    96             if (input) {
    97                 var inputElement = $(input)
    98                 var type = inputElement.attr('type');
    99 
     98            if (input && type) {
    10099                switch (type) {
    101100                    case 'text':
  • trunk/web-app/js/table-editor.min.js

    r359 r460  
    1 function TableEditor(){}TableEditor.prototype={tableIdentifier:null,rowIdentifier:null,columnIdentifier:null,selected:null,init:function(d,a,b){this.tableIdentifier=d;this.rowIdentifier=a;this.columnIdentifier=b;var c=$(d);if(c){that=this;c.each(function(){that.initializeTable(this)})}},initializeTable:function(b){var a=this;$(b).selectable({filter:this.rowIdentifier,selected:function(c,d){a.attachColumnHandlers(d.selected)},unselected:function(c,d){a.deAttachColumnHandlers(d.selected)}})},deAttachColumnHandlers:function(b){var a=this;$(this.columnIdentifier,b).each(function(){var c=$(":input",$(this));if(c){$(c).unbind(".tableEditor")}})},attachColumnHandlers:function(d){var c=this;var b=0;var a=new RegExp("ui-autocomplete-input");$(this.columnIdentifier,d).each(function(){var e=$(":input",$(this));if(e){var h=$(e);var g=h.attr("type");switch(g){case"text":var f=b;if(a.test(h.attr("class"))){h.bind("autocompleteclose.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}else{h.bind("keyup.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}break;case"select-one":var f=b;h.bind("change.tableEditor",function(){c.updateSingleInputElements(e,f,"select")});break;case"checkbox":var f=b;h.bind("click.tableEditor",function(){c.updateSingleInputElements(e,f,"input")});break;case"hidden":break;case null:break;default:alert("unsupported element of type "+g+", please file a bug report containing this message and a screenshot for table-editor.js");break}}b++})},updateSingleInputElements:function(f,d,b){var g=this;var h=$(f);var i=h.parent();var a=i.parent();var k=a.parent();var j=this.getValue(h);$(".ui-selected",k).each(function(){$(g.columnIdentifier+":eq("+d+") "+b,$(this)).each(function(){var c=$(this);if(c.attr("type")!="hidden"){var e=g.getValue(c);if(e!=j){g.setValue(c,j)}}})})},getValue:function(a){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked");break;default:return b.val();break}},setValue:function(a,c){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked",c);break;default:return b.val(c);break}}};
     1function TableEditor(){}TableEditor.prototype={tableIdentifier:null,rowIdentifier:null,columnIdentifier:null,selected:null,init:function(d,a,b){this.tableIdentifier=d;this.rowIdentifier=a;this.columnIdentifier=b;var c=$(d);if(c){that=this;c.each(function(){that.initializeTable(this)})}},initializeTable:function(b){var a=this;$(b).selectable({filter:this.rowIdentifier,selected:function(c,d){a.attachColumnHandlers(d.selected)},unselected:function(c,d){a.deAttachColumnHandlers(d.selected)}})},deAttachColumnHandlers:function(b){var a=this;$(this.columnIdentifier,b).each(function(){var c=$(":input",$(this));if(c){$(c).unbind(".tableEditor")}})},attachColumnHandlers:function(d){var c=this;var b=0;var a=new RegExp("ui-autocomplete-input");$(this.columnIdentifier,d).each(function(){var e=$(":input",$(this));var h=$(e);var g=h.attr("type");if(e&&g){switch(g){case"text":var f=b;if(a.test(h.attr("class"))){h.bind("autocompleteclose.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}else{h.bind("keyup.tableEditor",function(){c.updateSingleInputElements(e,f,"input")})}break;case"select-one":var f=b;h.bind("change.tableEditor",function(){c.updateSingleInputElements(e,f,"select")});break;case"checkbox":var f=b;h.bind("click.tableEditor",function(){c.updateSingleInputElements(e,f,"input")});break;case"hidden":break;case null:break;default:alert("unsupported element of type "+g+", please file a bug report containing this message and a screenshot for table-editor.js");break}}b++})},updateSingleInputElements:function(f,d,b){var g=this;var h=$(f);var i=h.parent();var a=i.parent();var k=a.parent();var j=this.getValue(h);$(".ui-selected",k).each(function(){$(g.columnIdentifier+":eq("+d+") "+b,$(this)).each(function(){var c=$(this);if(c.attr("type")!="hidden"){var e=g.getValue(c);if(e!=j){g.setValue(c,j)}}})})},getValue:function(a){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked");break;default:return b.val();break}},setValue:function(a,c){var b=$(a);switch(b.attr("type")){case"checkbox":return b.attr("checked",c);break;default:return b.val(c);break}}};
Note: See TracChangeset for help on using the changeset viewer.