簡體   English   中英

從Flexigrid抓取單元格文本導致使用主復選框時出現問題

[英]Grabbing cell text from Flexigrid causing problems when using master checkbox

我有一個功能,可從已選中復選框的flexigrid獲取單元格文本值。 但是我有一個問題。 當我單擊主復選框(不包含任何文本值,因為它與列標題一起顯示)時,它會由於主復選框而消失。

這是我得到的錯誤: Uncaught Error: Syntax error, unrecognized expression: #

這是我從Flexigrid獲取事件日期的函數:

function getSelectedCopyDates() {
            var arr = new Array();
                //for every row that has a checked checkbox
                $("tr").has(".noteCheckBox:checked").each(function (i) {
                        //push the value of column(FName, LName) into the array 
                        arr.push($("#" + this.id + "> td[abbr='EventDate'] > div").text());
                    }
                });
            return arr;

    }

這是我的flexigrid的片段:

 $('#viewNotesGrid').flexigrid({
            url: url,
            dataType: 'json',
            method: 'get',
            colModel: [
                { display: '<input type="checkbox" class="noteCheckBox" id="checkAllNotes" />', name: 'checkBox', width: 20, sortable: false, align: 'center', process: showDescription },
                { display: 'File ID', name: 'FileID', width: 70, sortable: true, align: 'center', process: showDescription, hide: true },

這是它的樣子: 在此處輸入圖片說明

使用$(“ tr:has(:not('th'))”)選擇器選擇不帶主復選框的tr復選框行

      $("tr:has(:not('th'))").has(".noteCheckBox:checked").each(function (i) {
          if ($("tr").has(".checkAllNotes:checked")){
                    arr.push($("#" + this.id + "> td[abbr='EventDate'] > div").text());
                }
            });

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM