Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ext.data.WakandaModel

  • Loading branch information...
commit 6693d5db46800a79a53ed17f40e01e48f508bdc7 1 parent 7adb3d5
@goldledoigt goldledoigt authored
View
BIN  example/Recipes/Recipes/ServerSymbolTable.waSymData
Binary file not shown
View
BIN  example/Recipes/Recipes/SymbolTable.waSymData
Binary file not shown
View
3  example/Recipes/Recipes/WebFolder/scripts/ext/ext-all-debug.js
@@ -26421,10 +26421,11 @@ Ext.define('Ext.data.Model', {
],
onClassExtended: function(cls, data) {
-
+ console.log("LIB: onClassExtended", this, arguments, data.fields, cls.prototype.superclass.fields);
var onBeforeClassCreated = data.onBeforeClassCreated;
data.onBeforeClassCreated = function(cls, data) {
+ console.log("onBeforeClassCreated", this, arguments);
var me = this,
name = Ext.getClassName(cls),
prototype = cls.prototype,
View
21 example/Recipes/Recipes/WebFolder/scripts/sencha2.js
@@ -0,0 +1,21 @@
+/************************************************************/
+/************************************************************/
+/************************************************************/
+
+
+Ext.onReady(function() {
+
+ Ext.define('Employee', {
+ extend: 'Ext.data.WakandaModel'
+ });
+
+ var store = Ext.create('Ext.data.Store', {
+ autoLoad: true,
+ model: 'Employee'
+ });
+
+ store.on('load', function() {
+ console.log("range", store.getRange(), store.getRange()[0].get('lastName'), store.getRange()[0].getId());
+ });
+
+});
View
7 example/Recipes/Recipes/WebFolder/sencha2.html
@@ -10,7 +10,12 @@
<body>
<!-- <script type="text/javascript" src="/waLib/WAF/Loader.js"></script> -->
<script type="text/javascript" src="scripts/ext/ext-all-debug.js"></script>
- <script type="text/javascript" src="scripts/Ext.data.proxy.Wakanda.js"></script>
+ <script type="text/javascript" src="https://raw.github.com/revolunet/sencha-wakanda/master/extjs/4.0.2a/Ext.data.proxy.Wakanda.js"></script>
+
+ <script type="text/javascript" src="scripts/sencha2.js"></script>
+
+
+
<!-- <script type="text/javascript" src="scripts/Ext.grid.WakandaColumns.js"></script>
<script type="text/javascript" src="scripts/wakanda.js"></script>
<script type="text/javascript" src="scripts/sencha.js"></script> -->
View
39 extjs/4.0.2a/Ext.data.WakandaModel.js
@@ -0,0 +1,39 @@
+Ext.define('Ext.data.WakandaModel', {
+
+ extend: 'Ext.data.Model',
+
+ idProperty: '__KEY',
+
+ proxy: {
+ type: 'wakanda',
+ reader: {
+ type: 'json',
+ idProperty: '__KEY',
+ root: '__ENTITIES',
+ totalProperty: '__COUNT'
+ }
+ },
+
+ onClassExtended: function(cls, data) {
+ console.log("onClassExtended", this, arguments);
+ console.log("fields", this.prototype.fields, this.superclass.superclass.fields);
+ var catalog = this.prototype.getCatalog(data.$className);
+ console.log("catalog", catalog);
+ data.fields = catalog.attributes;
+ this.superclass.superclass.$onExtended.apply(this, arguments);
+ },
+
+ getCatalog: function(className) {
+ console.log('getCatalog', this, arguments);
+ var catalog;
+ Ext.Ajax.request({
+ async: false,
+ url: 'http://' + window.location.host + '/rest/$catalog/' + className,
+ success: function(response) {
+ catalog = Ext.decode(response.responseText);
+ }
+ });
+ return catalog;
+ }
+
+});
Please sign in to comment.
Something went wrong with that request. Please try again.