2012-10-03 2 views
0

다음 코드는 내 코드입니다. 더블 클릭 이벤트는 jeditable에 의해 캐치 및 실행되지 않습니다.jeditable 편집 루틴을 실행하지 않음

자바 스크립트 :

$(document).ready(function(){ 
    $(".edit_area").editable('http://my_cgi_url', { 
     event  : 'dblclick', 
     type  : 'textarea', 
     rows  : 3, 
     cols  : 30, 
     cancel  : 'Cancel', 
     submit  : 'Save', 
     indicator : '<img src="images/indicator.gif">', 
     placeholder: 'Double Click to enter text', 
     tooltip : 'Double Click to edit...', 
     name  : 'comment' 
    }); 


    //Please note there is another peice of code which is capturing clikc events inside the table columns, 
    // which goes like this... 
    //I doubt it is catching the double-click before the above function.... 
    //I am not sure how to make the editable catch the doubleclick event??.... 

    var rowi, coli, cellval; //global as called in other subroutine too.... 
    $(".mytbl tbody tr").live('click',function (e) { 
     rowi = this.rowIndex; 
     coli = e.target.cellIndex; 
     cellval = $('tr').eq(rowi).find('td').eq(coli).text(); 
     var propvalue = $('tr').eq(0).find('th').eq(coli).text(); 
     //and some other functions..... 
    }); 
}); 

HTML의 SAMPLE 하나 개의 테이블 레코드를 다음 edit_area의 DIV의 ID가 각 테이블 행에 대해 고유합니다.

페이지가로드 된 후 ajax 호출을 통해 테이블이 추가되므로 pageload의 페이지에 ID/div 등이 없습니다. div mytbldiv 만 페이지에 항상 존재합니다.

<div id="mytbldiv"> 
    <table class="mytbl" border="1"> 
     <tr><th>header1</th><th>Header2</th></tr> 
     <tr><td>A</td><td><div class="edit_area" id="uniqelementid_forthisrow">text_to_edit</div></td></tr> 
    </table> 
</div> 

답변

0

편집 가능한 것은 새 테이블을 페이지에 추가하는 자바 스크립트 코드로 실행해야합니다. 그런 식으로 요소에 올바르게 연결되고 원하는대로 작동합니다.

관련 문제