zchermit

Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • in reply to: Custom Cell Class #84949
    zchermit
    Participant

    Good time of the day, Tony!

    A small change in the code above. Call addClass functions should be done before the call formatter.
    In this case, formatting can be managed through the classes too. For example, turn it off in class ‘unformat ‘:)

    @@ -659,16 +659,17 @@
    grid.cols[k] = this;
    });
    };
    – var addCell = function(t,row,cell,pos) {
    + var addCell = function(t,row,cell,pos,cssp) {
    var td;
    td = document.createElement(“td”);
    – formatter($(td,t),row,cell,pos,’add’);
    + if (cssp) { $(td,t).addClass(cssp); }
    + formatter($(td,t),row,cell,pos,’add’);
    row.appendChild(td);
    formatCol($(td,t), pos);
    };
    var formatter = function (elem, row, cellval , colpos, act){
    var cm = ts.p.colModel[colpos];
    – if(cm.formatter) {
    + if ( (cm.formatter) && (!$(elem).hasClass(‘unformat’)) ) {
    var opts= {rowId: row.id, colModel:cm,rowData:row};
    if($.isFunction( cm.formatter ) ) {
    cm.formatter(elem,cellval,opts,act);

    With best wishes,
    Serg.

    in reply to: Allow beforeEditCell to abort edits #84919
    zchermit
    Participant

    Hi, Zupert, Pat and Tony!!

    I also wanted to prohibit the editing of individual cells rather than the column immediately.

    If you have managed styles for each cell (such as in the post Custom Cell Class) this could be quite simple: just check for class “readonly” in cell:

    @@ -1351,6 +1360,7 @@
                 td = (e.target || e.srcElement);
                 if (td.href) { return true; }
                 var scb = $(td).hasClass(”cbox”);
    +            var ro = !$(td).hasClass(”readonly”);
                 ptr = $(td,ts.rows).parent(”tr”);
                 if($(ptr).length === 0 ){
                     ptr = $(td,ts.rows).parents(”tr:first”);
    @@ -1365,7 +1375,7 @@
                         } else {
                             ri = ptr[0].rowIndex;
                             ci = td.cellIndex;
    -                        try {$(ts).editCell(ri,ci,true,true);} catch (e) {}
    +                        try {$(ts).editCell(ri,ci,ro,true);} catch (e) {}
                         }
                     } else if ( !ts.p.multikey ) {
                         if(ts.p.multiselect && ts.p.multiboxonly) {

    Regards,

    Serg.

Viewing 2 replies - 1 through 2 (of 2 total)

Stay connected with us in your favorite flavor!