Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted on Oct 29, 2008 08:14
open dhtmlx forum
yes, I need it visible

and I need to be able type something into input text field. Right now I am able to display input text fiels within cell but unable to type in that field anything.    

The code is:

myGrid=new dhtmlXGridObject("divMyGrid");

myGrid.setColTypes("ed,ed,ed,ed......

.......................................

myGrid.enableEditEvents(true,true,true);

var onRowSelectEvent = myGrid.attachEvent("onRowSelect",function(rowId,cellInd){
               
            var cellValue=myGrid.cells(rowId,0).getValue();
                if (cellInd==0 ){
                 
                 myGrid.cells(rowId,0).setValue("");

                  myGrid.cells(rowId,0).setValue("<div id='blah' style='z-index:5000'></div>");

                   $('blah').innerHTML="<input type='text' size='14' value='"+cellValue+"' tabindex='1' id='searchField' class='searchField' name='searchField'>";
                     $('searchField').style.backgroundImage="url('includes/img/icons/magnifier.gif')";
                        $('searchField').style.backgroundRepeat="no-repeat";
                            $('searchField').style.backgroundPosition="right";

                    }
                 else {
                             
                myGrid.cells(rowId,0).setValue($('searchProject1').value);
             }
                return true;
               
           
        });

Answer posted by Support on Oct 29, 2008 09:53
The reason for the problem is that each time you click inside input grids onRowSelect event occurs and input redraw...

Try to set onclick event handler for your input and block bubbling there:

$('blah').innerHTML="<input type='text' onclick='(arguments[0]||event).cancelBubble=true'...>";