2
產生我有一個簡單的類包裝,我已經把一個模塊的命名組件內的網格控件類的一個實例,當我在Firefox 14.0.1測試它我得到:火狐不能與打字稿
類型錯誤:Components.Grid是不是構造@http:// ...
這裏通過打字稿生成的代碼:
var Components;
(function (Components) {
Components.gridDefaults = {
datatype: "json",
autowidth: true,
rowNum: 30,
rowList: [
10,
20,
30
],
viewrecords: true,
sortorder: "asc",
pager: "#grid-pager"
};
var Grid = (function() {
function Grid(selector, options) {
var opts = Components.gridDefaults;
if(options !== undefined && options !== null) {
$.extend(opts, options);
}
this.grid = $(selector).jqGrid(opts);
}
Grid.prototype.setToolbar = function (options) {
var pager = this.grid.getGridParam().pager;
if(pager !== undefined && pager !== null) {
this.grid.navGrid(pager, options);
}
return this;
};
Grid.prototype.jqGrid = function() {
return this.grid;
};
Grid.prototype.filter = function (criteria) {
this.grid.setGridParam({
page: 1,
postData: criteria
});
this.reload();
};
Grid.prototype.reload = function() {
this.grid.trigger("reloadGrid");
};
return Grid;
})();
Components.Grid = Grid;
})(Components || (Components = {}));
//@ sourceMappingURL=grid-component.js.map
這裏行了火狐抱怨缺乏一個構造函數:
var grid = new Components.Grid("#grid-container", {
url: "/Home/Data",
colNames: ['Inv No', 'Date', 'Client', 'Amount', 'Tax', 'Total', 'Notes'],
colModel: [
{ name: 'id', index: 'id', width: 55 },
{ name: 'invdate', index: 'invdate', width: 90, jsonmap: "invdate" },
{ name: 'name', index: 'name asc, invdate', width: 100 },
{ name: 'amount', index: 'amount', width: 80, align: "right" },
{ name: 'tax', index: 'tax', width: 80, align: "right" },
{ name: 'total', index: 'total', width: 80, align: "right" },
{ name: 'note', index: 'note', width: 150, sortable: false }
],
jsonReader: {
id: "id",
repeatitems: false
}
});
我想聽聽某人@TypeScript團隊的消息。
+1 - 就Firefox而言,組件實際上是一個保留字:https://developer.mozilla.org/en/docs/Components.utils.import – Fenton 2013-02-08 16:52:52
Scott,感謝我帶走了另一個愚蠢的時刻... 你釘了它! – 2013-02-08 17:32:19