2017-08-16 50 views
-1

我想過濾列表格式中動態發送的數據。如果我 使用了SearchOptions事件,那麼它會拋出錯誤TypeError:無法讀取未定義或空引用的「stype」。任何人都可以爲我提供解決方案。在下面示出網格模型:TypeError:無法讀取JQGrid中未定義或空引用的「stype」

jQuery("#list2").jqGrid({ 
    url: '/LocaleRate/LocaleRates', 
    datatype: "json", 
    colModel: [ 
     { name: 'Id', hidden: true }, 
     { 
      name: 'SourceLocaleId', index: 'SourceLocaleName', width: 130, align: "left", editable: true, edittype: "select", formatter: 'select', editoptions: { value: LocaleList }, editrules: { required: true ,   stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: LocaleList 
     }, 
     { 
      name: 'LocaleId', index: 'LocaleName', width: 90, align: "left", editable: true, edittype: "select", formatter: 'select', editoptions: { value: LocaleList }, editrules: { required: true }, stype: "select", searchoptions: { value: LocaleList } 
     }, 
     { 
      name: 'CompanyId', index: 'CompanyName', editable: true, width: 100, editable: true, edittype: "select", formatter: 'select', 
      editoptions: {value: CompanyList}, editrules: { required: true}, 
      stype: "select", searchoptions: { value: CompanyList } 
     }, 
     { name: 'VDBID', id: 'VDBID', editable: true, width: 90, editrules: { required: true }, editoptions: { readonly: "readonly" } }, 
     { 
      name: 'CurrencyId', index: 'CurrencyName', width: 100, editable: true, edittype: "select", formatter: 'select', editoptions: { value: CurrencyList }, editrules: { required: true }, 
      stype: "select", searchoptions: { value: CurrencyList } 
     }, 
     { name: 'HourRate', id: 'HourRate', editable: true, width: 130, editrules: { required: true } }, 
     { name: 'PageRate', id: 'PageRate', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'WordRateExact', id: 'WordRateExact', editable: true, width: 130, editrules: { required: true } }, 
     { name: 'WordRateDuplicate', id: 'WordRateDuplicate', editable: true, width: 140, editrules: { required: true } }, 
     { name: 'WordRateFuzzy', id: 'WordRateFuzzy', editable: true, width: 130, editrules: { required: true } }, 
     { name: 'WordRateNew', id: 'WordRateNew', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'MinimumPageCount', id: 'MinimumPageCount', editable: true, width: 130, editrules: { required: true } }, 
     { name: 'MinimumWordCount', id: 'MinimumWordCount', editable: true, width: 130, editrules: { required: true } }, 
     { name: 'WordRateExactComplex', id: 'WordRateExactComplex', editable: true, width: 150, editrules: { required: true } }, 
     { name: 'MinimumCharge', id: 'MinimumCharge', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'WordRateDuplicateComplex', id: 'WordRateDuplicateComplex', editable: true, width: 150, editrules: { required: true } }, 
     { name: 'WordRateFuzzyComplex', id: 'WordRateFuzzyComplex', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'WordRateNewComplex', id: 'WordRateNewComplex', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'FirstProofRate', id: 'FirstProofRate', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'WordRateHighFuzzy', id: 'WordRateHighFuzzy', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'WordRateHighFuzzyComplex', id: 'WordRateHighFuzzyComplex', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'DTPVendorHourRate', id: 'DTPVendorHourRate', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'DTPVendorPageRate', id: 'DTPVendorPageRate', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'VDBPriceLineID', id: 'VDBPriceLineID', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'MTRate', id: 'MTRate', editable: true, width: 90, editrules: { required: true } }, 
     { name: 'DTPClientHourRate', id: 'DTPClientHourRate', editable: true, width: 90, editrules: { required: true } }, 
     { 
      name: 'IsActive', editable: true, width: 40, edittype: "checkbox", editoptions: { value: "True:False" } 
     } 
    ], 
    rowNum: 10, 
    rowList: [10, 20, 30], 
    pager: '#pager', 
    loadonce: true, 
    sortname: 'id', 
    height: "auto", 
    width: 2000, 
    viewrecords: true, 
    sortorder: "desc", 
    caption: "JSON Example", 
    jsonReader: { 
     root: "rows", 
     page: "page", 
     total: "total", 
     records: "records", 
     repeatitems: false, 
     id: "0" 
    }, 
    autowidth: true, 
}); 

jQuery("#list2").jqGrid('filterToolbar', { 
    stringResult: true, 
    searchOnEnter: false,  
}); 

參照上面的代碼,我想在其上具有動態數據SourceLocaleId,的LocaleID,CompanyId & CurrencyId領域的過濾器。

+0

改進格式化,去除噪音 –

回答

0

在這裏,我已經以列表方式將具有動態數據的每列的索引值從'SourceLocaleName'替換爲'SourceLocaleId'。

相關問題