如何在 Windows Azure Pack 管理入口網站擴充功能中顯示方格
適用于:Windows Azure Pack
方格是向使用者顯示資料清單的基本方式。 它支援多重選取、資料行重新排序和排序、圖示和文字的顯示,以及從定義的資料來源自動重新整理本身。 一般模式是當使用者選取索引標籤時,延伸模組會顯示方格。
當使用者選取索引標籤時顯示方格
將下列方格程式碼放在索引標籤的已開啟函式中:
// This function has been set to be the opened function earlier // For this to work, there should be a <div> in your template for the tab with a class of "gridContainer" function loadTab(extension, renderArea, initData) { // Create a dataset so the client-side framework knows how to get the data for refreshes var localDataSet = Exp.Data.getLocalDataSet(DomainTenantExtension.Controller.listOwnedDomainNamesUrl), // Define the columns in the grid. A number of pre-defined types exist. columns = [ { name: "Name", field: "Name", sortable: false }, { name: "Status", field: "Status", type: "status", displayStatus: waz.interaction.statusIconHelper(statusIcons), filterable: false, sortable: false }, { name: "Type", field: "Type", filterable: false, sortable: false }, { name: "Expires", field: "ExpiryDate", filterable: false, sortable: false, formatter: dateFormatter } ]; grid = renderArea.find(".gridContainer") .wazObservableGrid("destroy") .wazObservableGrid({ lastSelectedRow: null, data: localDataSet.data, keyField: "name", columns: columns, gridOptions: { // Function to call when a row is selected. Optional. rowSelect: onRowSelected }, // If the grid is empty, a template can be rendered instead, typically suggesting to the user that they create a new resource emptyListOptions: { extensionName: "DomainTenantExtension", templateName: "domainsTabEmpty", arrowLinkSelector: ("{0} .dm-new-domain-link").format(renderArea.selector), arrowLinkAction: global.DomainTenantExtension.CreateWizard.showCreateWizard } }); }