javascript - How do I use the Yahoo YUI to do inline cell editing that writes to a database? -
so have datatable setup using yui 2.0. , 1 of column definitions, i've set when click on cell, set of radio button options pops can modify cell content.
i want whatever changes made reflected in database. subscribe radioclickevent. here code that:
ex.mydatatable.subscribe("radioclickevent", function(oargs){
// hold change yahoo.util.event.preventdefault(oargs.event); // block user doing this.disable(); // read need var elcheckbox = oargs.target, newvalue = elcheckbox.checked, record = this.getrecord(elcheckbox), column = this.getcolumn(elcheckbox), oldvalue = record.getdata(column.key), recordindex = this.getrecordindex(record), session_code = record.getdata(\'session_code\'); alert(newvalue); // check against server yahoo.util.connect.asyncrequest( "get", "inlineeddit.php?sesscode=session_code&", { success:function(o) { alert("good"); var r = yahoo.lang.json.parse(o.responsetext); if (r.replycode == 200) { // if ok, change var data = record.getdata(); data[column.key] = newvalue; this.updaterow(recordindex,data); } else { alert(r.replytext); } // unblock interface this.undisable(); }, failure:function(o) { alert("bad"); //alert(o.statustext); this.undisable(); }, scope:this } ); }); ex.mydatatable.subscribe("cellclickevent", ex.mydatatable.oneventshowcelleditor);
but when run code , click on cell , click radio button, nothing happens ever. i've been looking @ time , have no idea i'm doing wrong. know can use asyncsubmitter within column definition believe , tried that, wasn't working me.
any ideas appreciated.
Comments
Post a Comment