jqgrid number formatter use

В моем модуле форматирования у меня есть следующий код:

formatter: {
    number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
},

, а в моем colModel у меня:

  { name: 'SalesPrice', index: 'SalesPrice', width: 90, align: 'left', formatter:'number', editable: true, editoptions:
                  {
                      readonly: true
                  }
                  }

Мой тип данных установлен на "local"

Когда я впервые показываю форму, я получаю «0,00», а не «0,0000», как я ожидал. Более того, в режиме встроенного редактирования значение SalesPrice изменяется в зависимости от других ячеек в сетке. После обновлений значение SalesPrice отображается в виде целого числа.

Что я делаю не так?

РЕДАКТИРОВАТЬ: Более полный код

$("#customerOrderLineList").jqGrid({
    //      url: 'someUrl',
    datatype: 'local',
    formatter: {
        number: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }
    },
    //      mtype: 'POST',
    colNames: [ 'Part Number', 'Sales Price'],
    colModel: [
                  { name: 'PartNumber', index: 'PartNum', width: 90, align: 'left', editable: true, editoptions:
                  {
                      dataInit: function (el) {
                          $(el).autocomplete({
                              source: "Autocomplete",
                              minLength: 1
                          });
                      }
                  }
                  },

                  { name: 'SalesPrice', index: 'SalesPrice', width: 90, align: 'left', formatter: 'number',
                      formatoptions: { decimalSeparator: ".", thousandsSeparator: " ", decimalPlaces: 4, defaultValue: '0.0000' }, editable: true, editoptions:
                  {
                      readonly: true
                  }
                  }
             ],
    pager: jQuery('#pager'),
    rowNum: 10,
    rowList: [5, 10, 20, 50],
    sortable: true,
    sortname: 'PartNum',
    sortorder: "asc",
    viewrecords: true,
    imgpath: '',
    autowidth: true,
    onSelectRow: function (id, status) {
        if (id && id !== lastsel) {
            $('#customerOrderLineList').jqGrid('restoreRow', lastsel);
            $('#customerOrderLineList').jqGrid('editRow', id, true);
            lastsel = id;
        }
    },
    caption: 'Caption'
});
6
задан DavidS 21 July 2011 в 13:47
поделиться