2013-11-01 3 views
3

다른 모든 브라우저에서 모든 필드를 올바르게 정렬합니다.jquery tablesorter가 입력/선택 필드 (IE8)에서 작동하지 않고 IE8의 다른 모든 텍스트 필드에서 올바르게 작동합니다.

필드가 입력 필드 (jquery datepicker)이거나 특정 상자를 선택하는 경우 IE8 만 문제입니다.

<tr class="proj_rec" data-id="<?php echo $project->get_id(); ?>"> 
        <td class="proj_id"> 
         <?php echo $project->get_id(); ?> 
        </td> 
        <td> 
         <?php echo $project->get_desc(); ?> 
        </td> 
        <td class="edit"> 
         <select class="touch"> 
          <?php echo $opt_html_business_area; ?> 
         </select> 
         <span class="look"> 
          <?php echo $project->get_business_area(); ?> 
         </span> 
        </td> 
        <td class="edit"> 
         <select class="touch"> 
          <?php echo $opt_html_status; ?> 
         </select> 
         <span class="look"> 
          <?php echo $project->get_status(); ?> 
         </span> 
        </td> 
        <td class="edit"> 
         <select class="touch"> 
          <?php echo $opt_html_type; ?> 
         </select> 
         <span class="look"> 
          <?php echo $project->get_type(); ?> 
         </span> 
        </td> 
        <td class="edit"> 
         <input type="text" class="touch"> 
         </input> 
         <span class="look"> 
          <?php echo $project->get_owner(); ?> 
         </span> 
        </td> 
        <td> 
         <?php echo $project->get_enter_date(); ?> 
        </td> 
        <td class="edit"> 
         <input type="text" class="touch dtpick"> 
         </input> 
         <span class="look"> 
          <?php echo $project->get_est_date(); ?> 
         </span> 
        </td> 
        <td class="edit"> 
         <input type="text" class="touch dtpick"> 
         </input> 
         <span class="look"> 
          <?php echo $project->get_due_date(); ?> 
         </span> 
        </td> 
        <td class="edit"> 
         <input type="text" class="touch dtpick"> 
         </input> 
         <span class="look"> 
          <?php echo $project->get_next_date(); ?> 
         </span> 
        </td> 


//project events that happen only on page load 
function on_load_events() { 
    // Adding a new slot 
    $('#add_project').click(function() { 
     var emp = $('#entered_new').val(); 
     add_project(emp); 
    }); 

    $('#project_table').bind('sortStart',function() { 
     back_to_look(); 
     $('span.cmnt_active').each(function() { 
      remove_comments($(this)); 
     }); 
    }); 

    $('#project_table').tablesorter({ 
     textExtraction: myTextExtraction 
    }); 

    //todo: try getting the dataTable to work... 
    // it might be way better, just not sure how it would handle 
    // adding unrelated rows on the fly (comments) 
    //$('#project_table').dataTable(); 
} 

String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');}; 

var myTextExtraction = function(node) 
{ 
    var elem = $(node); 
    var theVal = null; 

    if (elem.hasClass('edit')) { 
     elem.children().each(function() { 
      if ($(this).css('display') != 'none') { 
       theVal = $(this).val(); 
      } 
     }); 

    } else { 
     theVal = elem.text(); 
    } 

    //console.log(theVal); 


    var c = node.childNodes.length; 

    if (c == 1) { 
     theVal = node.innerHTML.trim(); 
    } else if (c == 5) { 
     theVal = node.childNodes[3].innerHTML.trim(); 
    } 

    //console.log(theVal); 
    return theVal; 

} 

이 피들과 같은 조건문이 있어야합니까?

http://jsfiddle.net/Mottie/AqXEA/1/

어떤 도움

주시면 감사하겠습니다.

답변

0

게시 한 jsfiddle에는 datepicker 입력이나 선택 사항이 없습니다. jsfiddle을 새로 작성하여 귀하의 데이터를 나타낼 수 있습니다. 귀하의 경우 textExtraction 함수가 내용을 인식하고 적절한 값을 검색하기를 원합니다. 아래 함수는 datepickers에 대한 입력 값과 select에 대해 선택된 값을 가져옵니다.

 textExtraction: function(node) 
     { 
      var elem = $(node); 
      var text = ''; 
      if(elem.find('input').length > 0){ 
       text = elem.find('input').val().trim();  
      } else if(elem.find('select').length > 0){ 
       text = elem.find('select option[selected]').text().trim(); 
      } else { 
       text = elem.text().trim(); 
      } 
      return text; 
     } 

데이터의 양에 따라 가장 효율적인 구현은 아니지만 올바른 방향으로 갈 수 있도록 도와야합니다. 희망은 도움이

관련 문제