2011-07-18 6 views
1

Pour une raison quelconque (inconnu pour moi) l'événement 'formatCell' ne se déclenche pas (aucun message d'alerte affiché). voir code ci-dessous:jqGrid formatCell événement ne se déclenche pas

$("#jqgrid").jqGrid({ 
      datatype: "json", 

      colNames: ['CurrecncyID', 'Currency', 'Value', 'Calculated', 'Value', '%', 'Calculated'], 
      colModel: [ 
         { name: 'CurrecncyID', index: 'CurrecncyID', hidden: true, width: 40 }, 
         { name: 'CurrencyName', index: 'CurrencyName', width: 150 }, 
         { name: 'FullPrice', index: 'FullPrice', width: 100, editrules: { custom: true, custom_func: priceCheck }, editable: true, align: 'right', formatter: priceFormatter }, 
         { name: 'CalcFullPrice', index: 'CalcFullPrice', width: 100, align: 'right', formatter: priceFormatter }, 
         { name: 'ActualPrice', index: 'ActualPrice', width: 100, editrules: { custom: true, custom_func: priceCheck }, editable: true, align: 'right', formatter: priceFormatter }, 
         { name: 'Precent', index: 'Precent', width: 100, align: 'right', formatter: 'integer', formatoptions: { prefix: "% "} }, 
         { name: 'CalcActualPrice', index: 'CalcActualPrice', width: 100, align: 'right', formatter: priceFormatter }, 
        ], 
      onSelectRow: function (id) { 
       if (id && id !== lastsel) { 
        jQuery('#jqgrid').restoreRow(lastsel); 
        jQuery('#jqgrid').editRow(id, true); 
        lastsel = id; 
       } 
      }, 
      formatCell: function (rowid, cellname, value, iRow, iCol) { 
       alert("before edit"); 
      }, 
      jsonReader: { 
       repeatitems: false 
      }, 
      rowNum: 20, 
      rowList: [10, 20, 30], 
      pager: '#jqpager', 
      sortname: 'CurrecncyID', 
      viewrecords: true, 
      sortorder: "desc", 
      caption: "Prices List", 
      autowidth: true, 
      height: "100%", 
      loadtext: "Loading...", 
      editurl: "/handlers/myurl.ashx" 
     });` 
+0

CurrecncyID est mal orthographié, aussi vous devriez utiliser un débogueur javascript pour avoir plus d'informations sur votre problème, celui de Firefox fonctionne bien. –

+0

Juste pour clarifier, vous pouvez utiliser un débogueur tel que Firebug dans Firefox pour traquer des problèmes comme celui-ci. –

+0

Merci, mais ce n'est pas ça. la source de données est également mal orthographié :) – Red

Répondre

Questions connexes