0.10.227 • Published 12 days ago

json-object-editor v0.10.227

Weekly downloads
2,452
License
(c) Copyright 201...
Repository
bitbucket
Last release
12 days ago

Json Object Editor

JOE is software that allows you to manage data models via JSON objects. There are two flavors, the client-side version and nodejs server platform.

SERVER/PLATFORM mode

check port 2099
/JOE/
/JsonObjectEditor/docs.html
*Should auto-open on start

Json Object Editor (Universal-esque software) (requires connection to a mongo server for full functionality)

JOE server instantiation (add to entry point js file)

var joe = require('json-object-editor');
or here's a custom example
var joe = require('json-object-editor')({
	name:'name_your_joe' (JOE),
	joedb:'local_custom_database_name' // {{mongoURL}}' if using mongolab or remote mongodb,
	port:'4099', (2099)
	socketPort:'4098', (2098)
	sitesPort:'4100' (2100),
	clusters:1,
	hostname:'server name if not localhost'(localhost)
});

$J (universal) Shorthand JOE

$J to access helper funtions on client and server. (callbacks are optional)
$J.get(itemId,[callback])
$J.schema(schemaname,[callback])

Client-Side (front end only)

js client only instantiation

var specs = {
	fields:{
		species:{label:'Species',type:'select', values:['cat','dog','rat','thing'], onchange:adjustSchema},
		gender:{type:'select', values:['male','female']},
		legs:{label:'# of Legs',type:'int', onblur:logit},
		weight:{label:' Weight (lbs)',type:'number', onblur:logit},
		name:{label:' pet Name', onkeyup:logValue},
		//id:{label:'ID',type:'text', locked:true},
		id:{label:'ID',type:'guid'},
		
	//example of select that takes function (function is passed item)	
		animalLink:{label:'Link to other animal',type:'select', values:getAnimals},
		hiddenizer:{hidden:true}
	},
	schemas:{
		animal:animalschema,
		thing:thingschema			
	},
	container:string ('body'),
    compact:false,
    useBackButton:true,
	autosave:2000,
    listSubMenu:{filters:{}},
    useHashlink:true,
    title:'${itemtype} | ${display}'
}
var JOE = new JsonObjectEditor(specs);
JOE.init();

##JOE CONFIG ##specs

  • useBackButton:false if true, back button moves through joe panels when joe has history to go to (is open).
  • useHashlink:false, true or a template for hashlinks. default template is '${schemaname}${_id}' default server tempalte is '${schema_name}/${_id}' ##SCHEMA CONFIG ###fields Properties for all Fields

  • label / display: what the field should display as *If the field type is boolean, label controls checkbox/boolean label

  • value: default value if not one in object
  • default: default value for field || function(object)
  • type: what type of field should JOE show
  • hidden: boolean / function, value will be added (but unsees by user)
  • locked: boolean
  • condition: boolean
  • width: used for layout control. - can use pixels or percentages (as string)
  • comment: a commentthat shows up at the beginning of the field
  • tooltip: hover/clickable tooltip that shows up next to name

field types:

  • rendering: for css html and js
  • text: default single line text. - autocomplete: boolean // obj of specs (template, idprop) - values:array of possibilities -maxlength:string
  • int: integer field
  • number: number (float) field
  • select: select list. - multiple(bool) - values(array of objects, {value:"",name/display:""), can be a function - disabled:boolean(func acceptable) - idprop: string of prop name
  • geo: shows a map - takes a string array "lat,lon" - center:lat,lon, center of map - zoom: zoom level (higher zooms in more) - returns "lat,lon" -image : shows an image and HxW as th image url is typed in.
  • multisorter : allows arrays of objects to be selected and sorted in right bin. - values(array of objects, {value:"",name/display:""), can be a function
  • content : show content on in the editor
    • run: function to be run(current_object,field_properties)
    • template: html template for fillTemplate(template,current_object);
  • objectlist : a table of objects with editable properties
    • properties: array of objects|strings for the object property names -name: value in object -display: header in objectList
    • max: integer, number or items that can be added. use zero for infinite.
    • hideHeadings: don't show table headings
  • objectReference : a list of object ids
    • template
    • autocomplete_template
    • idprop
    • values
    • max(0 unlimited)
    • sortable(true)
  • code : - language
  • boolean: - label:controls checkbox label
  • preview : -content: string or function(current joe object) to replace everything on page (template). -bodycontent: same as content, only replaces body content. -url: preview page if not the default one. - encoded: boolean, if pre uriencoded labels:

  • pass an object instead of a string to the fields array.

{label:'Name of the following properties section'}

##page sections {section_start: 'SectionName', section_label:'Section Name with Labels', condition:function(item){ return item.show;} }, {section_end: 'CreativeBrief'}

  • pass an object instead of a string to the fields array. these show up on the details view as anchors.
  • Object Properties
    • section_start: name/id of section
    • 'section_label:use instead of section_start for display name
    • section_end: name/id of section(str)
    • template: html template for fillTemplate(template,current_object);

##page sidebar {sidebar_start: 'SectionName', sidebar_label:'Section Name with Labels', condition:function(item){ return item.show;} }, {sidebar_end: 'CreativeBrief'}

  • pass an object instead of a string to the fields array. these show up on the details view as anchors.
  • Object Properties
    • sidebar_start: name/id of sidebar
    • sidebar_label:use instead of sidebar_start for display name
    • sidebar_end: name/id of sidebar(str)
    • template: html template for fillTemplate(template,current_object);

###defaultProfile overwrites the default profile

#schemas

a list of schema objects that can configure the editor fields, these can be given properties that are delegated to all the corresponding fields.

var animalschema = 
{
	title:'Animal', *what shows as the panel header* 
	fields:['id','name','legs','species','weight','color','gender','animalLink'], *list of visible fields*
	_listID:'id', *the id for finding the object*
	_listTitle:'${name} ${species}', *how to display items in the list*
	menu:[array of menu buttons],
	listMenuTitle: (string) template forjoe window title in list view,
	listmenu:[array of menu buttons] (multi-edit and select all always show),
	/*callback:function(obj){
		alert(obj.name);
	},*/
	onblur:logit,
	hideNumbers:boolean *toggle list numbers*
	multipleCallback:function to be called after a multi-edit. passed list of edited items.
	onUpdate: callback for after update. passed single edited items.
	onMultipleUpdate:callback for after multi update.passed list of edited items.
            filters: array of objects
}

##Table View - add tableView object to a schema; -cols = strings||objects -string is the name and value -display/header is the column title -property/name = object property ###Pre-formating you can preformat at the joe call or schema level. The data item will be affected by the passed function (which should return the preformated item).

##menu## an array of menu buttons

//the default save button
//this is the dom object, 
//use _joe.current.object for current object
condition:function(field,object) to call
self = Joe object
var __saveBtn__ = {name:'save',label:'Save', action:'_joe.updateObject(this);', css:'joe-save-button'};

##itemMenu## as array of buttons for each item in list views - name - action (action string) - url (instead of js action) - condition

##itemExpander## template or run for content to be shown under the main list item block.

###Addition properties Changing the schema on the fly?

_joe.resetSchema(new schema name);

css (included) options

  • joe-left-button
  • joe-right-button

##FIELDS

{extend:'name',specs:{display:'Request Title'}},//extends the field 'name' with the specs provided.

##usage

a | adding a new object

_joe.show({},{schema:'animal',callback:addAnimal); 
//or goJoe(object,specs)

...
function addAnimal(obj){
	animals.push(obj);
}

b | viewing a list of objects

goJoe([array of objects],specs:{schema,subsets,subset})
goJoe.show(animals,{schema:'animal',subsets:[{name:'Two-Legged',filter:{legs:2}}]});
//use the specs property subset to pre-select a subset by name

properties

  • _listWindowTitle: the title of the window (can be passed in with the schema);
  • _listCount: added to the current object and can be used in the title.
  • _listTitle:'${name} ${species}', how to display items in the list
  • _icon: str template for a list item icon (standard min 50x50), 'http://www.icons.com/${itemname}', can be obj with width, height, url
  • listSubMenu:a function or object that represents the list submenu
  • stripeColor:string or function that returns valid css color descriptor.
  • bgColor:string or function that returns valid css color descriptor.
  • subsets: name:string, filter:object
  • subMenu:a function or object that represents the single item submenu

  • _listTemplate: html template that uses ${var} to write out the item properties for the list item. - standard css class joe-panel-content-option

###c | Conditional select that changes the item schema

fields:{
	species:{label:'Species',type:'select', values:['cat','dog','rat','thing'], onchange:adjustSchema},
	[field_id]:{
		
		+label : STR
		+type : STR
		value : STR (default value)
		+values : ARRAY/FUNC (for select)
		
		//modifiers
		+hidden:BOOL/STRING(name of field that toggles this) //don't show, but value is passed
		+locked:BOOL // show, but uneditable
		//events
		+onchange : FUNC
		+onblur : FUNC
		+onkeypress : FUNC
		+rerender : STRING // name of field to rerender
	}
}

function adjustSchema(dom){
	var species = $(dom).val();
	if(species == "thing"){
		JOE.resetSchema('thing')
	}
	else{
		JOE.resetSchema('animal')
	
	}
}

###d | duplicating an item

//duplicates the currently active object (being edited)
_joe.duplicateObject(specs);

specs

  • deletes:array of properties to clear for new item - note that you will need to delete guid/id fields or the id will be the same.

e | exporting an object in pretty format json (or minified)

JOE.exportJSON = function(object,objvarname,minify)

##Useful Functions _joe.reload(hideMessage,specs)

  • use specs.overwreite object to extend reloaded object.

_joe.constructObjectFromFields()

0.10.226

12 days ago

0.10.227

12 days ago

0.10.224

19 days ago

0.10.225

19 days ago

0.10.222

20 days ago

0.10.223

20 days ago

0.10.220

1 month ago

0.10.210

1 month ago

0.10.201

1 year ago

0.10.200

1 year ago

0.10.110

1 year ago

0.10.120

1 year ago

0.10.0

2 years ago

0.9.901

3 years ago

0.9.891

3 years ago

0.9.89

3 years ago

0.9.88

3 years ago

0.9.87

3 years ago

0.9.85

3 years ago

0.9.86

3 years ago

0.9.83

3 years ago

0.9.82

3 years ago

0.9.81

3 years ago

0.9.80

3 years ago

0.9.79

3 years ago

0.9.78

3 years ago

0.9.75

3 years ago

0.9.76

3 years ago

0.9.77

3 years ago

0.9.73

3 years ago

0.9.72

3 years ago

0.9.71

3 years ago

0.9.7

3 years ago

0.9.69

3 years ago

0.9.67

3 years ago

0.9.68

3 years ago

0.9.66

3 years ago

0.9.65

3 years ago

0.9.64

3 years ago

0.9.63

3 years ago

0.9.61

3 years ago

0.9.62

3 years ago

0.9.60

3 years ago

0.9.59

3 years ago

0.9.58

3 years ago

0.9.57

3 years ago

0.9.55

3 years ago

0.9.53

3 years ago

0.9.54

3 years ago

0.9.41

3 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.8.993

4 years ago

0.8.992

4 years ago

0.8.990

4 years ago

0.8.984

5 years ago

0.8.983

5 years ago

0.8.982

5 years ago

0.8.981

5 years ago

0.8.980

5 years ago

0.8.979

5 years ago

0.8.978

5 years ago

0.8.977

5 years ago

0.8.976

5 years ago

0.8.975

5 years ago

0.8.974

5 years ago

0.8.972

5 years ago

0.8.971

5 years ago

0.8.970

5 years ago

0.8.963

5 years ago

0.8.962

5 years ago

0.8.961

5 years ago

0.8.960

5 years ago

0.8.952

5 years ago

0.8.951

5 years ago

0.8.950

5 years ago

0.8.934

5 years ago

0.8.933

5 years ago

0.8.932

5 years ago

0.8.931

5 years ago

0.8.930

5 years ago

0.8.925

5 years ago

0.8.924

5 years ago

0.8.923

5 years ago

0.8.922

5 years ago

0.8.921

5 years ago

0.8.920

5 years ago

0.8.912

5 years ago

0.8.911

5 years ago

0.8.910

5 years ago

0.8.901

5 years ago

0.8.900

5 years ago

0.8.893

5 years ago

0.8.892

5 years ago

0.8.891

5 years ago

0.8.890

5 years ago

0.8.883

5 years ago

0.8.882

5 years ago

0.8.881

5 years ago

0.8.880

5 years ago

0.8.872

5 years ago

0.8.871

5 years ago

0.8.870

5 years ago

0.8.865

5 years ago

0.8.864

5 years ago

0.8.863

5 years ago

0.8.862

5 years ago

0.8.861

5 years ago

0.8.860

5 years ago

0.8.853

5 years ago

0.8.851

5 years ago

0.8.850

5 years ago

0.8.843

5 years ago

0.8.842

5 years ago

0.8.841

5 years ago

0.8.840

5 years ago

0.8.830

5 years ago

0.8.824

5 years ago

0.8.823

5 years ago

0.8.822

5 years ago

0.8.821

5 years ago

0.8.820

5 years ago

0.8.811

5 years ago

0.8.810

5 years ago

0.8.800

5 years ago

0.8.750

5 years ago

0.8.740

5 years ago

0.8.730

5 years ago

0.8.720

5 years ago

0.8.710

5 years ago

0.8.700

5 years ago

0.8.601

5 years ago

0.8.600

5 years ago

0.8.551

6 years ago

0.8.550

6 years ago

0.8.541

6 years ago

0.8.540

6 years ago

0.8.533

6 years ago

0.8.532

6 years ago

0.8.531

6 years ago

0.8.530

6 years ago

0.8.521

6 years ago

0.8.520

6 years ago

0.8.512

6 years ago

0.8.511

6 years ago

0.8.510

6 years ago

0.8.502

6 years ago

0.8.501

6 years ago

0.8.500

6 years ago

0.8.469

6 years ago

0.8.468

6 years ago

0.8.467

6 years ago

0.8.466

6 years ago

0.8.465

6 years ago

0.8.464

6 years ago

0.8.463

6 years ago

0.8.462

6 years ago

0.8.461

6 years ago

0.8.460

6 years ago

0.8.453

6 years ago

0.8.452

6 years ago

0.8.451

6 years ago

0.8.450

7 years ago

0.8.442

7 years ago

0.8.441

7 years ago

0.8.440

7 years ago

0.8.438

7 years ago

0.8.437

7 years ago

0.8.436

7 years ago

0.8.434

7 years ago

0.8.433

7 years ago

0.8.431

7 years ago

0.8.430

7 years ago

0.8.429

7 years ago

0.8.428

7 years ago

0.8.427

7 years ago

0.8.426

7 years ago

0.8.425

7 years ago

0.8.424

7 years ago

0.8.423

7 years ago

0.8.422

7 years ago

0.8.421

7 years ago

0.8.420

7 years ago

0.8.414

7 years ago

0.8.413

7 years ago

0.8.412

7 years ago

0.8.411

7 years ago

0.8.410

7 years ago

0.8.407

7 years ago

0.8.406

7 years ago

0.8.404

7 years ago

0.8.403

7 years ago

0.8.402

7 years ago

0.8.401

7 years ago

0.8.400

7 years ago

0.8.336

7 years ago

0.8.335

7 years ago

0.8.334

7 years ago

0.8.333

7 years ago

0.8.332

7 years ago

0.8.331

7 years ago

0.8.330

7 years ago

0.8.320

7 years ago

0.8.313

7 years ago

0.8.312

7 years ago

0.8.311

7 years ago

0.8.310

7 years ago

0.8.303

7 years ago

0.8.302

7 years ago

0.8.301

7 years ago

0.8.300

7 years ago

0.8.282

7 years ago

0.8.281

7 years ago

0.8.280

7 years ago

0.8.279

7 years ago

0.8.277

7 years ago

0.8.276

7 years ago

0.8.275

7 years ago

0.8.274

7 years ago

0.8.273

7 years ago

0.8.272

7 years ago

0.8.271

7 years ago

0.8.267

7 years ago

0.8.266

7 years ago

0.8.265

7 years ago

0.8.264

7 years ago

0.8.263

7 years ago

0.8.262

7 years ago

0.8.261

7 years ago

0.8.260

7 years ago

0.8.251

7 years ago

0.8.250

7 years ago

0.8.249

7 years ago

0.8.248

7 years ago

0.8.247

7 years ago

0.8.246

7 years ago

0.8.245

7 years ago

0.8.240

7 years ago

0.8.232

7 years ago

0.8.231

7 years ago

0.8.230

7 years ago

0.8.220

7 years ago

0.8.211

7 years ago

0.8.200

7 years ago

0.8.191

7 years ago

0.8.190

7 years ago

0.8.182

7 years ago

0.8.181

7 years ago

0.8.180

7 years ago

0.8.175

7 years ago

0.8.174

7 years ago

0.8.173

7 years ago

0.8.172

7 years ago

0.8.171

7 years ago

0.8.170

7 years ago

0.8.162

7 years ago

0.8.161

7 years ago

0.8.160

7 years ago

0.8.141

7 years ago

0.8.140

7 years ago

0.8.135

7 years ago

0.8.134

7 years ago

0.8.133

7 years ago

0.8.132

7 years ago

0.8.131

7 years ago

0.8.130

7 years ago

0.8.120

7 years ago

0.8.112

7 years ago

0.8.111

7 years ago

0.8.110

7 years ago

0.8.100

7 years ago

0.8.4

7 years ago

0.8.3

7 years ago

0.8.2

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.999

7 years ago

0.7.998

7 years ago

0.7.997

7 years ago

0.7.996

7 years ago

0.7.995

7 years ago

0.7.992

7 years ago

0.7.991

7 years ago

0.7.990

7 years ago

0.7.982

8 years ago

0.7.981

8 years ago

0.7.980

8 years ago

0.7.970

8 years ago

0.7.963

8 years ago

0.7.962

8 years ago

0.7.961

8 years ago

0.7.953

8 years ago

0.7.952

8 years ago

0.7.951

8 years ago

0.7.950

8 years ago

0.7.940

8 years ago

0.7.932

8 years ago

0.7.926

8 years ago

0.7.925

8 years ago

0.7.922

8 years ago

0.7.921

8 years ago

0.7.920

8 years ago

0.7.906

8 years ago

0.7.905

8 years ago

0.7.904

8 years ago

0.7.900

8 years ago

0.7.851

8 years ago

0.7.850

8 years ago

0.7.840

8 years ago

0.7.810

8 years ago

0.7.800

8 years ago

0.7.742

8 years ago

0.7.741

8 years ago

0.7.740

8 years ago

0.7.730

8 years ago

0.7.720

8 years ago

0.7.717

8 years ago

0.7.716

8 years ago

0.7.715

8 years ago

0.7.714

8 years ago

0.7.713

8 years ago

0.7.712

8 years ago

0.7.711

8 years ago

0.7.710

8 years ago

0.7.705

8 years ago

0.7.704

8 years ago

0.7.703

8 years ago

0.7.702

8 years ago

0.7.701

8 years ago

0.7.700

8 years ago

0.7.61

8 years ago

0.7.6

8 years ago

0.7.53

8 years ago

0.7.52

8 years ago

0.7.51

8 years ago

0.7.5

8 years ago

0.7.47

8 years ago

0.7.451

8 years ago

0.7.45

8 years ago

0.7.44

8 years ago

0.7.42

8 years ago

0.7.41

8 years ago

0.7.4

8 years ago

0.7.3

8 years ago

0.7.241

8 years ago

0.7.24

8 years ago

0.7.23

8 years ago

0.7.22

8 years ago

0.7.21

8 years ago

0.7.2

8 years ago

0.7.13

8 years ago

0.7.12

8 years ago

0.7.1

8 years ago

0.7.0

8 years ago

0.6.93

8 years ago

0.6.92

8 years ago

0.6.91

8 years ago

0.6.9

8 years ago

0.6.81

8 years ago

0.6.8

8 years ago

0.6.7

8 years ago

0.6.61

8 years ago

0.6.6

8 years ago

0.6.5

8 years ago

0.6.49

8 years ago

0.6.48

8 years ago

0.6.47

8 years ago

0.6.46

8 years ago

0.6.45

8 years ago

0.6.44

8 years ago

0.6.43

8 years ago

0.6.42

8 years ago

0.6.41

8 years ago

0.6.4

8 years ago

0.6.32

8 years ago

0.6.31

8 years ago

0.6.3

8 years ago

0.6.2

8 years ago

0.6.11

8 years ago

0.6.1

8 years ago

0.6.0

8 years ago

0.5.9

8 years ago

0.5.8

8 years ago

0.5.71

8 years ago

0.5.7

8 years ago

0.5.6

8 years ago

0.5.53

8 years ago

0.5.52

8 years ago

0.5.51

8 years ago

0.5.5

8 years ago

0.5.4

8 years ago

0.5.31

8 years ago

0.5.3

8 years ago

0.5.2

8 years ago

0.5.1

8 years ago

0.5.0

8 years ago

0.4.41

8 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.21

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.4

8 years ago

0.3.2

8 years ago

0.3.1

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago