Index: /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/_field.py
===================================================================
--- /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/_field.py	(revision 2265)
+++ /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/_field.py	(revision 2266)
@@ -10,6 +10,8 @@
 from Products.CMFCore.utils import getToolByName
 from Products.validation import validation #validators import baseValidators
-from Products.Archetypes.Field import encode
+from Products.Archetypes.Field import encode, ReferenceField
 from Products.Archetypes.Registry import registerField, registerWidget
+
+from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget
 
 from Products.DataGridField.DataGridField import DataGridField
@@ -21,17 +23,21 @@
 #logger.debug("ReferenceDataGrid loading")
 
-class ReferenceDataGridWidget(DataGridWidget):
-    _properties = DataGridWidget._properties.copy()
+class ReferenceDataGridWidget(DataGridWidget, ReferenceBrowserWidget):
+    _properties = ReferenceBrowserWidget._properties.copy()
+    _properties.update(DataGridWidget._properties.copy())
     _properties.update({
-        'macro' : "referencedatagridwidget",
+        'macro': "referencedatagridwidget",
         'column_names': ['Title', 'Link or UID'],
+        'helper_css': ('datagridwidget.css',),
+        'helper_js': ('referencebrowser.js', 'datagridwidget.js',),
         })
 
 isURL = validation.validatorFor('isURL')
 
-class ReferenceDataGridField(DataGridField):
-    _properties = DataGridField._properties.copy()
+class ReferenceDataGridField(DataGridField, ReferenceField):
+    _properties = ReferenceField._properties.copy()
+    _properties.update(DataGridField._properties.copy())
     _properties.update({
-        'columns' : ('title', 'link_uid'),
+        'columns': ('title', 'link_uid'),
         'widget': ReferenceDataGridWidget,
         })
Index: /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/examples/ReferenceDataGridDemoType.py
===================================================================
--- /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/examples/ReferenceDataGridDemoType.py	(revision 2265)
+++ /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/examples/ReferenceDataGridDemoType.py	(revision 2266)
@@ -16,4 +16,5 @@
         ReferenceDataGridField('DemoReferenceDataGridField',
             schemata='default',
+            relationship="demo_relation",
             widget = ReferenceDataGridWidget(
                 label = "Reference DataGrid Field(s)",
Index: /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/datagridwidget_manipulators.pt
===================================================================
--- /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/datagridwidget_manipulators.pt	(revision 2266)
+++ /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/datagridwidget_manipulators.pt	(revision 2266)
@@ -0,0 +1,117 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:tal="http://xml.zope.org/namespaces/tal"
+      xmlns:metal="http://xml.zope.org/namespaces/metal"
+      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+      i18n:domain="plone">
+
+<body>
+
+    <metal:define define-macro="edit_manipulators">   
+    
+     	 <tal:manipulator-cells>
+     	 	
+     	 	<tal:comment replace="nothing">
+	             IE doesn't seem to respect em unit paddings here so we
+	             use absolute pixel paddings.
+          	</tal:comment>
+
+          	<tal:comment replace="nothing">
+          		<!-- Add reference -->
+          	</tal:comment>
+
+		<td class="datagridwidget-manipulator"
+		    tal:define="multiVal      python:0;
+				fieldRealName field/getName;
+				">
+		    <div style="clear: both"
+			 tal:define="startup_directory python:here.referencebrowser_startupDirectory(widget.getStartupDirectory(here));
+				     global at_url at_url|python:'/'.join(here.getPhysicalPath());
+				     field_id string:link_uid_${fieldId}">
+			<input type="button"
+			       class="searchButton"
+			       value="Add Reference"
+			       onClick=""
+			       i18n:attributes="value label_add;"
+			       tal:attributes="onClick string:javascript:referencebrowser_openBrowser('${startup_directory}','${field_id}', '${at_url}', '${fieldRealName}')" />
+                    </div>
+		</td>
+
+          	<tal:comment replace="nothing">
+          		<!-- Insert -->	        
+          	</tal:comment>
+
+	         <td class="datagridwidget-manipulator"
+	         	tal:condition="python: widget.isInsertEnabled(context, field)">
+	             <img tal:attributes="
+	                  	src string:${portal_url}/add_row_icon.gif;
+	                  	"
+	                  alt="Add row"  
+	                  onclick="dataGridFieldFunctions.addRowAfter(this); return false"/>
+	         </td>          	
+
+          	<tal:comment replace="nothing">
+          		<!-- Delete -->	        
+          	</tal:comment>    
+	         <td  class="datagridwidget-manipulator"
+	         	tal:condition="python: widget.isDeleteEnabled(context, field)">
+	             <img tal:attributes="
+	                  	src string:${portal_url}/delete_row_icon.gif;
+	                  	"
+	                  alt="Delete row"  
+	                  onclick="dataGridFieldFunctions.removeFieldRow(this);return false"/>
+	         </td>
+		    
+          	<tal:comment replace="nothing">
+          		<!-- Move up -->	        
+          	</tal:comment>    	    
+		    <td class="datagridwidget-manipulator">
+	
+		       <img tal:attributes="
+		             	src string:${portal_url}/move_row_up_icon.gif;
+		             	" 
+		             alt="Move row up"  
+		             tal:condition="python: widget.isReorderEnabled(context, field)"
+		             onclick="dataGridFieldFunctions.moveRowUp(this);return false"/>
+		                                                    
+		    </td>
+		    
+          	<tal:comment replace="nothing">
+          		<!-- Move down -->	        
+          	</tal:comment>    	    		    
+		    <td class="datagridwidget-manipulator">
+		    
+		    	<img tal:attributes="
+		             	src string:${portal_url}/move_row_down_icon.gif;
+		             	" 
+		             alt="Move row down"  
+		             tal:condition="python: widget.isReorderEnabled(context, field)"
+		             onclick="dataGridFieldFunctions.moveRowDown(this);return false"/>
+		             
+		    </td>
+		    
+
+          	<tal:comment replace="nothing">
+          		<!-- The index field of this row -->	        
+          	</tal:comment>    	    		    
+		    <td class="datagridwidget-hidden-data">
+
+			   <tal:ordering-field tal:condition="newRow">
+	               <input type="hidden"
+	                       value="template_row_marker"
+	                       tal:attributes="name string:${fieldName}.orderindex_:records;
+	                                       id string:orderindex__${fieldId};" />
+				</tal:ordering-field>	  		    
+				
+			   <tal:ordering-field tal:condition="not: newRow">
+			       <input type="hidden"
+			               tal:attributes="name string:${fieldName}.orderindex_:records;
+			                               id string:orderindex__${fieldId};
+			                               value repeat/rows/number;" />    
+			   </tal:ordering-field>                                    							    
+		    </td>
+		        
+		</tal:manipulator-cells>
+    </metal:define>
+</body>
+
+</html>   
Index: /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/referencedatagridwidget.pt
===================================================================
--- /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/referencedatagridwidget.pt	(revision 2265)
+++ /quintagroup.referencedatagridfield/trunk/quintagroup/referencedatagridfield/skins/referencedatagridfield/referencedatagridwidget.pt	(revision 2266)
@@ -34,4 +34,5 @@
       <div metal:use-macro="field_macro | here/datagridwidget/macros/edit">
       </div>
+      
     </metal:define>
 
