prepare use of grid field
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3009 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
3ac67abd37
commit
16a3212f7a
2 changed files with 38 additions and 18 deletions
|
@ -23,9 +23,10 @@ $Id$
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import component
|
from zope import component
|
||||||
from zope.interface import implements
|
|
||||||
from zope.cachedescriptors.property import Lazy
|
|
||||||
from zope.component import adapts
|
from zope.component import adapts
|
||||||
|
from zope.interface import implements
|
||||||
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
|
from zope.cachedescriptors.property import Lazy
|
||||||
import zope.schema
|
import zope.schema
|
||||||
|
|
||||||
from cybertools.composer.schema.factory import createField
|
from cybertools.composer.schema.factory import createField
|
||||||
|
@ -36,6 +37,9 @@ from cybertools.util.format import toStr, toUnicode
|
||||||
from cybertools.util import json
|
from cybertools.util import json
|
||||||
|
|
||||||
|
|
||||||
|
grid_macros = ViewPageTemplateFile('grid_macros.pt')
|
||||||
|
|
||||||
|
|
||||||
class GridFieldInstance(ListFieldInstance):
|
class GridFieldInstance(ListFieldInstance):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
|
|
|
@ -6,21 +6,37 @@
|
||||||
<metal:input define-macro="input_grid"
|
<metal:input define-macro="input_grid"
|
||||||
tal:define="fieldInstance python: field.getFieldInstance(view.instance);
|
tal:define="fieldInstance python: field.getFieldInstance(view.instance);
|
||||||
columns fieldInstance/columnTypes">
|
columns fieldInstance/columnTypes">
|
||||||
|
<script type="text/javascript" language="JavaScript"
|
||||||
<span dojoType="dojo.data.ItemFileWriteStore"
|
tal:content="string:
|
||||||
tal:attributes="jsId string:store_$name;
|
data_$name = dojo.fromJson('${data/?name}');
|
||||||
data data/?name"/>
|
store_$name = new dojo.data.ItemFileWriteStore({data: data_$name});
|
||||||
|
store_$name._saveEverything = function(ccb, ecb, data) {
|
||||||
<table dojoType="dojox.grid.DataGrid"
|
dojo.byId('$name').value = data;
|
||||||
style="width: 35em; height: 15em"
|
};
|
||||||
tal:attributes="name name; id name;
|
dojo.connect(dojo.byId('editForm'), 'onsubmit', function(evt) {
|
||||||
|
dijit.byId('grid_$name').edit.apply();
|
||||||
|
store_$name.save();
|
||||||
|
});">
|
||||||
|
</script>
|
||||||
|
<textarea rows="3" style="display: none"
|
||||||
|
tal:attributes="name name; id name">
|
||||||
|
</textarea>
|
||||||
|
<table dojoType="dojox.grid.DataGrid" query="{name: '*'}"
|
||||||
|
style="width: 100%; height: 12em"
|
||||||
|
singleClickEdit="true"
|
||||||
|
tal:attributes="id string:grid_$name;
|
||||||
store string:store_$name">
|
store string:store_$name">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<tal:header repeat="column columns">
|
<tal:header repeat="column columns">
|
||||||
<th tal:attributes="field column/name"
|
<th width="auto" editable="true"
|
||||||
tal:content="column/title">Column Title</th>
|
tal:attributes="field column/name"
|
||||||
</tal:header>
|
tal:content="column/title">Column Title</th>
|
||||||
</tr></thead></table>
|
</tal:header>
|
||||||
|
</tr></thead>
|
||||||
|
</table>
|
||||||
</metal:input>
|
</metal:input>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue