1
0
Fork 0

documentview editable bugfix

This commit is contained in:
Heiko Kernbach 2013-02-22 12:10:11 +01:00
parent 3ecf22cfd6
commit 816e3dd906
3 changed files with 12 additions and 11 deletions

View File

@ -1,4 +1,5 @@
arangoHelper = {
CollectionTypes: {},
systemAttributes: function () {
return {
'_id' : true,
@ -13,6 +14,9 @@ arangoHelper = {
'$id' : true
};
},
getRandomToken: function () {
return Math.round(new Date().getTime());
},
isSystemAttribute: function (val) {
var a = this.systemAttributes();
@ -25,11 +29,11 @@ arangoHelper = {
},
collectionApiType: function (identifier) {
if (CollectionTypes[identifier] == undefined) {
CollectionTypes[identifier] = getCollectionInfo(identifier).type;
if (this.CollectionTypes[identifier] == undefined) {
this.CollectionTypes[identifier] = window.arangoDocumentStore.getCollectionInfo(identifier).type;
}
if (CollectionTypes[identifier] == 3) {
if (this.CollectionTypes[identifier] == 3) {
return "edge";
}
return "document";

View File

@ -2,7 +2,6 @@ window.arangoDocument = Backbone.Collection.extend({
url: '/_api/document/',
model: arangoDocument,
collectionInfo: {},
CollectionTypes: {},
deleteDocument: function (collectionID){
var returnval = false;
try {
@ -55,7 +54,7 @@ window.arangoDocument = Backbone.Collection.extend({
$.ajax({
type: "GET",
url: "/_api/collection/" + identifier + "?" + self.getRandomToken(),
url: "/_api/collection/" + identifier + "?" + arangoHelper.getRandomToken(),
contentType: "application/json",
processData: false,
async: false,
@ -68,9 +67,6 @@ window.arangoDocument = Backbone.Collection.extend({
return self.collectionInfo;
},
getRandomToken: function () {
return Math.round(new Date().getTime());
},
getDocument: function (colid, docid, view) {
this.clearDocument();
var self = this;

View File

@ -63,7 +63,7 @@ var documentView = Backbone.View.extend({
addLine: function () {
$(this.table).dataTable().fnAddData([
"somekey"+this.counter,
"key"+arangoHelper.getRandomToken(),
this.value2html("editme"),
JSON.stringify("editme"),
'edit',
@ -71,7 +71,8 @@ var documentView = Backbone.View.extend({
]);
this.makeEditable();
this.updateLocalDocumentStorage();
this.counter++;
$(this.table).dataTable().fnClearTable();
this.drawTable();
},
deleteLine: function (a) {
@ -156,7 +157,7 @@ var documentView = Backbone.View.extend({
$('.writeable', documentEditTable.fnGetNodes()).editable(function(value, settings) {
var aPos = documentEditTable.fnGetPosition(this);
if (aPos[1] == 0) {
documentEditTable.fnUpdate(value, aPos[0], aPos[0]);
documentEditTable.fnUpdate(value, aPos[0], aPos[1]);
self.updateLocalDocumentStorage();
return value;
}