0
有我需要在AG-網格來改變功能,爲此,我需要改變功能,例如從:覆蓋javascript函數AG-網格
NumberFilter.prototype.onFilterChanged = function() {
var filterText = utils_1.default.makeNull(this.eFilterTextField.value);
if (filterText && filterText.trim() === '') {
filterText = null;
}
var newFilter;
if (filterText !== null && filterText !== undefined) {
console.log(filterText);
newFilter = parseFloat(filterText);
console.log(newFilter);
}
else {
newFilter = null;
}
if (this.filterNumber !== newFilter) {
this.filterNumber = newFilter;
this.filterChanged();
}
};
要
NumberFilter.prototype.onFilterChanged = function() {
var filterText = utils_1.default.makeNull(this.eFilterTextField.value);
if (filterText && filterText.trim() === '') {
filterText = null;
}
var newFilter;
if (filterText !== null && filterText !== undefined) {
console.log(filterText);
// replace comma by dot
newFilter = parseFloat(filterText.replace(/,/g, '.'));
console.log(newFilter);
}
else {
newFilter = null;
}
if (this.filterNumber !== newFilter) {
this.filterNumber = newFilter;
this.filterChanged();
}
};
如何覆蓋ag-grid配置文件中的功能? 上面我離開演示示例的配置文件:
Link: https://plnkr.co/edit/LDdrRbANSalvb4Iwh5mp?p=preview
用圓點代替逗號不是一個足以覆蓋網格內部功能的理由。您是否嘗試過創建可以處理您的數字格式的自定義過濾器,如文檔中所述? – Tomalak
@Tomalak和閱讀文檔的一個小的改變,我需要基本上應用NumberFilter類的所有功能,所以我想知道是否有一種方法來繼承他的所有功能在一個新的對象,然後改變他的方法。我嘗試做的例子var CustomNumberFilter = Object.create(NumberFilter); ,但不起作用。 – Pedro