path='grocery.billing_location.shortname' required hidden> </eg-grid-field>
<eg-grid-field path='circulation.circ_lib' required hidden></eg-grid-field>
<eg-grid-field path='circulation.duration' required hidden></eg-grid-field>
- <eg-grid-field path='circulation.due_date' required hidden>
- {{ circulation.due_date | egDueDate:$root.egDateAndTimeFormat:circulation.circ_lib:circulation.duration}}
- </eg-grid-field>
+ <eg-grid-field path='circulation.due_date' dateonlyinterval="circulation.duration" datecontext="circulation.circ_lib" required hidden></eg-grid-field>
<eg-grid-field path='circulation.*' hidden> </eg-grid-field>
<eg-grid-field label="[% l('Checkout / Renewal Library') %]"
path='circulation.circ_lib.shortname' required hidden> </eg-grid-field>
* Others likely to follow...
*/
.filter('egGridValueFilter', ['$filter','egCore', function($filter,egCore) {
+ function traversePath(obj,path) {
+ var list = path.split('.');
+ for (var part in path) {
+ if (obj[path]) obj = obj[path]
+ else return undef;
+ }
+ return obj;
+ }
+
var GVF = function(value, column, item) {
switch(column.datatype) {
case 'bool':
? item[column.dateonlyinterval]()
: item[column.dateonlyinterval];
+ if (column.dateonlyinterval && !interval) // try it as a dotted path
+ interval = traversePath(item, column.dateonlyinterval);
+
var context = angular.isFunction(item[column.datecontext])
? item[column.datecontext]()
: item[column.datecontext];
+ if (column.datecontext && !context) // try it as a dotted path
+ context = traversePath(item, column.datecontext);
+
var date_filter = column.datefilter || 'egOrgDateInContext';
return $filter(date_filter)(value, column.dateformat, context, interval);