added basic infrastructure for inline cell editing. now we just need widgets
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 17 Dec 2008 21:39:35 +0000 (21:39 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 17 Dec 2008 21:39:35 +0000 (21:39 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@11617 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/conify/global/config/circ_modifier.js
Open-ILS/web/templates/default/conify/global/config/circ_modifier.tt2

index 5fa4404..cb401a0 100644 (file)
@@ -10,6 +10,7 @@ function buildCMGrid() {
     var store = new dojo.data.ItemFileWriteStore({data:ccm.initStoreData('code', {identifier:'code'})})
     cmGrid.setStore(store);
     cmGrid.render();
+    dojo.connect(store, 'onSet', cmGridChanged);
 
     fieldmapper.standardRequest(
         ['open-ils.permacrud', 'open-ils.permacrud.search.ccm'],
@@ -25,6 +26,18 @@ function buildCMGrid() {
     );
 }
 
+function cmGridChanged(item, attr, oldVal, newVal) {
+    var cm = cmCache[cmGrid.store.getValue(item, 'code')];
+    console.log("changing cm " + cm.code() + " object: " + attr + " = " + newVal);
+    cm[attr](newVal);
+    cm.ischanged(true);
+    cmSaveButton.setDisabled(false);
+}
+
+function saveChanges() {
+    /* loop through the changed objects in cmCache and update them in the DB */
+}
+
 function getMagneticMedia(rowIdx, item) {
     if(!item) return '';
     var magMed = this.grid.store.getValue(item, this.field);
index 4c8c9d9..0f142d5 100644 (file)
@@ -51,6 +51,7 @@
     </div> 
 
     <button dojoType='dijit.form.Button' onclick='deleteFromGrid();'>Delete Selected</button>
+    <button dojoType='dijit.form.Button' onclick='saveChanges();' disabled='disabled' jsId='cmSaveButton'>Save Changes</button>
 
     <div dojoType="dijit.layout.ContentPane" layoutAlign="client" style='height:600px;'>
         <table jsId="cmGrid" dojoType="dojox.grid.DataGrid" query="{name: '*'}" rowSelector='20px'>