Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stevo on Apr 15, 2008 23:50
open dhtmlx forum
Executing JS in GRID's subrow

Hi!

I wonder how I could force dhtmlx grid subrow to execute JS (that subrow contains) after being loaded by sub_row_ajax :/ Should i use 'onload' on some kind of subrow's inner container or something ?

The javascript i am talking about will be used to construct yui buttons.
Answer posted by Support on Apr 16, 2008 02:18
The current version of grid just loads content of sub_row through innerHTML, so inline scripts will not be executed automatically.
You can try to use the next code modification ( most probably we will add it as default functionality in next version of grid )

dhtmlxgrid_excell_sub_row.js, line 173

dhtmlXGridObject.prototype._sub_row_render={
    "ajax":function(that,d,td,c){
        d.innerHTML="Loading...";
        //d.innerHTML=that.i18n.loading;
        var xml=new dtmlXMLLoaderObject(function(){
            d.innerHTML=xml.xmlDoc.responseText;
           /*start of modification*/
                var z=xml.xmlDoc.responseText.match(/<script[^>]*>([^<]+)<\/script>/g);
                if (z)
                    for (var i=0; i<z.length; i++)
                        eval(z[i].replace(/<([\/]{0,1})s[^>]*>/g,""));
           /*end of modification*/