Skip to content

Instantly share code, notes, and snippets.

@jacobandresen
Created April 18, 2014 18:34
Show Gist options
  • Save jacobandresen/02d7351a17e284a0d9aa to your computer and use it in GitHub Desktop.
Save jacobandresen/02d7351a17e284a0d9aa to your computer and use it in GitHub Desktop.
<html>
<head>
<link rel='stylesheet' type='text/css' href='../../ext4/resources/css/ext-all.css'/>
<script type='text/javascript' src='../../ext4/ext-all-debug.js'></script>
<script type='text/javascript' src='7.5_The_Employee_model_with_validations.js'></script>
</head>
<body>
<script type='text/javascript'>
//var urlRoot = 'http://extjsinaction.com/crud.php?model=Employee&method=';
var urlRoot = 'crud.php?model=Employee&method=';
var employeeStore = Ext.create('Ext.data.Store', {
model : 'Employee',
proxy : {
type : 'ajax',
api : {
create : urlRoot + 'CREATE',
read : urlRoot + 'READ',
update : urlRoot + 'UPDATE',
destroy : urlRoot + 'DESTROY'
},
reader : {
type : 'json',
root : 'data',
idProperty : 'id',
successProperty : 'meta.success'
},
writer : {
type : 'json',
encode : true,
writeAllFields : true,
root : 'data',
allowSingle : true,
batch : false,
writeRecords : function(request, data) {
request.jsonData = data;
return request;
}
}
}
});
employeeStore.load();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment