* handler fires. Otherwise, onKeyUp is called on the lib selector
* instead of acqLitAddCopyCount, causing focus to jump to the second
* selector.
+ *
+ * Takes a boolean to determine whether it'll use the original Evergreen
+ * behavior. True will bring it to the Distribution Formula selector,
+ * while False will retain the original behavior of setting focus to the
+ * first copy's owning library selector.
+ *
*/
- this.focusCopyLibSelector = function() {
+ this.focusCopyLibSelector = function(toDistribFormula) {
setTimeout(function() {
- var row = dojo.query('tr', self.copyTbody)[0];
- if (!row) return;
+ var row;
+ var selector;
+ if(toDistribFormula) {
+ row = dojo.query('div', 'acq-lit-distrib-formula-tbody')[0];
+ if (row) selector = dojo.query('input', row)[0];
+ } else {
+ row = dojo.query('tr', self.copyTbody)[0];
- // The first filteringtreeselect is our owning lib selector
- // They are sequential, but don't necessarily start with _1,
- // since rows can be arbitrarily removed.
- var selector = dojo.query(
- '[id^="openils_widget_FilteringTreeSelect_"]', row)[0];
+ // The first filteringtreeselect is our owning lib selector
+ // They are sequential, but don't necessarily start with _1,
+ // since rows can be arbitrarily removed.
+ if (row) selector = dojo.query(
+ '[id^="openils_widget_FilteringTreeSelect_"]', row)[0];
+ }
+ if (!row) return;
if (selector) selector.focus();
}, 100);
}
// KCLS -- after adding or removing copies, focus the library
// selector of the first copy in the list.
- self.focusCopyLibSelector();
+ self.focusCopyLibSelector(true);
}
if(copy.isnew())
delete this.copyCache[copy.id()];
this.copyTbody.removeChild(row);
- this.focusCopyLibSelector();
+ this.focusCopyLibSelector(true);
}
this._virtDfaCountsAsList = function() {