From: erickson Date: Wed, 10 Dec 2008 19:27:32 +0000 (+0000) Subject: more movement toward markup-based grids X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5efe9fdd184f25baec9cf87cd5ca2b3f7e2edefc;p=Evergreen.git more movement toward markup-based grids git-svn-id: svn://svn.open-ils.org/ILS/trunk@11504 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js b/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js index 1f408ad7d6..5b3725158a 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_currency_types.js @@ -1,6 +1,7 @@ dojo.require("dijit.Dialog"); dojo.require('dijit.form.Button'); -dojo.require('dojox.grid.Grid'); +dojo.require('dojox.grid.DataGrid'); +dojo.require('dojo.data.ItemFileReadStore'); dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.Util'); @@ -13,10 +14,9 @@ function loadCTypesGrid() { function(types) { var store = new dojo.data.ItemFileReadStore( {data:acqct.toStoreData(types, 'code', {identifier:'code'})}); - var model = new dojox.grid.data.DojoData(null, store, - {rowsPerPage: 20, clientSort: true, query:{code:'*'}}); - currencyTypeListGrid.setModel(model); - currencyTypeListGrid.update(); + + currencyTypeListGrid.setStore(store); + currencyTypeListGrid.render(); } ); } diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js index e700a6c732..bd9be344bc 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_funds.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_funds.js @@ -1,35 +1,35 @@ dojo.require("dijit.Dialog"); dojo.require("dijit.form.FilteringSelect"); dojo.require('dijit.form.Button'); -dojo.require('dojox.grid.Grid'); - +dojo.require('dojox.grid.DataGrid'); +dojo.require('dojo.data.ItemFileReadStore'); dojo.require('openils.widget.OrgUnitFilteringSelect'); dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.Util'); dojo.require('openils.acq.Fund'); -function getOrgInfo(rowIndex) { - data = fundListGrid.model.getRow(rowIndex); - if(!data) return; - return fieldmapper.aou.findOrgUnit(data.org).shortname(); -} +function getOrgInfo(rowIndex, item) { + + if(!item) return ''; + var owner = this.grid.store.getValue(item, 'org'); + return fieldmapper.aou.findOrgUnit(owner).shortname(); -function getBalanceInfo(rowIndex) { - data = fundListGrid.model.getRow(rowIndex); - if(!data) return; - return new String(openils.acq.Fund.cache[data.id].summary().combined_balance); } +function getBalanceInfo(rowIndex, item) { + if(!item) return ''; + var data = this.grid.store.getValue( item, 'id'); + return new String(openils.acq.Fund.cache[data].summary().combined_balance); +} function loadFundGrid() { openils.acq.Fund.createStore( function(storeData) { var store = new dojo.data.ItemFileReadStore({data:storeData}); - var model = new dojox.grid.data.DojoData(null, store, - {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); - fundListGrid.setModel(model); - fundListGrid.update(); + + fundListGrid.setStore(store); + fundListGrid.render(); var yearStore = {identifier:'year', name:'year', items:[]}; @@ -53,11 +53,10 @@ function loadFundGrid() { function filterGrid() { var year = fundFilterYearSelect.getValue(); if(year) - fundListGrid.model.query = {year:year}; + fundListGrid.query = {year:year}; else - fundListGrid.model.query = {id:'*'}; - fundListGrid.model.refresh(); - fundListGrid.update(); + fundListGrid.query = {id:'*'}; + fundListGrid.update(); } openils.Util.addOnLoad(loadFundGrid); diff --git a/Open-ILS/web/js/ui/default/acq/financial/list_providers.js b/Open-ILS/web/js/ui/default/acq/financial/list_providers.js index cf41b397c8..3516d59786 100644 --- a/Open-ILS/web/js/ui/default/acq/financial/list_providers.js +++ b/Open-ILS/web/js/ui/default/acq/financial/list_providers.js @@ -1,8 +1,8 @@ dojo.require("dijit.Dialog"); dojo.require("dijit.form.FilteringSelect"); dojo.require('dijit.form.Button'); -dojo.require('dojox.grid.Grid'); - +dojo.require('dojox.grid.DataGrid'); +dojo.require('dojo.data.ItemFileReadStore'); dojo.require('openils.acq.CurrencyType'); dojo.require('openils.Event'); dojo.require('openils.Util'); @@ -10,23 +10,23 @@ dojo.require('openils.acq.Provider'); dojo.require("fieldmapper.OrgUtils"); dojo.require('openils.widget.OrgUnitFilteringSelect'); -function getOrgInfo(rowIndex) { - data = providerListGrid.model.getRow(rowIndex); - if(!data) return; - return fieldmapper.aou.findOrgUnit(data.owner).shortname(); +function getOrgInfo(rowIndex, item) { + if(!item) return ''; + var owner = this.grid.store.getValue(item, 'owner'); + return fieldmapper.aou.findOrgUnit(owner).shortname(); } function loadProviderGrid() { openils.acq.Provider.createStore( function(storeData) { var store = new dojo.data.ItemFileReadStore({data:storeData}); - var model = new dojox.grid.data.DojoData(null, store, - {rowsPerPage: 20, clientSort: true, query:{id:'*'}}); - providerListGrid.setModel(model); - providerListGrid.update(); + + providerListGrid.setStore(store); + providerListGrid.render(); } ); } + function createProvider(fields) { openils.acq.Provider.create(fields, function(){loadProviderGrid()}); } diff --git a/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 b/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 index 751f91c06f..01f2fd2a6b 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_currency_types.tt2 @@ -35,13 +35,18 @@ - -
+ +
+
+ + + + + + + +
CodeLabel
+
+
+ [% END %] diff --git a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 index 31af992f2d..f4834b4509 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_funds.tt2 @@ -19,7 +19,7 @@ return; } else { location.href = /* go to the details page for this fund */ - '[% ctx.base_uri %]/acq/fund/view/'+fundId; + '[% ctx.base_uri %]/acq/fund/view/'+fundId; } } ); @@ -53,7 +53,7 @@ + dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'> @@ -61,7 +61,7 @@ + searchAttr="shortname" name="org" autocomplete="true" labelAttr='shortname'> @@ -75,35 +75,40 @@ + jsId='fundFilterYearSelect' labelAttr='year' searchAttr='year'> -
+ +
+
+ + + + + + + + + + + + +
IDNameCodeYearLocationCurrency TypeCombined Balance
+
+
[% END %] diff --git a/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 b/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 index 2f49dd40f2..5fea2b9dfc 100644 --- a/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 +++ b/Open-ILS/web/templates/default/acq/financial/list_providers.tt2 @@ -28,7 +28,7 @@ + dojoType="dijit.form.FilteringSelect" searchAttr='code' labelAttr='code'> @@ -36,7 +36,7 @@ + searchAttr="shortname" name="owner" autocomplete="true" labelAttr='shortname'> @@ -54,22 +54,28 @@ +
+
+ + + + + + + + + + +
IDNameCodeOwnerCurrency Type
+
+
- var providerGridStructure = [{ - cells : [[ - {name: 'ID', field: 'id'}, - {name: 'Name', get:getName, width:'auto'}, - {name: 'Code', field:'code'}, - {name: 'Owner', get:getOrgInfo}, - {name: 'Currency Type', field: "currency_type"} - ]] - }]; - -
[% END %]