{
  "FieldUnbound_Tree": { 
    "layout":"form",
    "caption": ["Category", "Categories"],
    "unbound": true,
    "buttons":[{"link":"insert:FieldUnbound_Tree_Category", "bindings": { "category_parent_id": "category_id" }, "text": "Add Subcategory" }],
    "fields": [
      {"name": "category_id","caption": "","control": "tree","always_editable":true, "unbound": true,
        "lov": { "sql": "select category_id code_id, category_parent_id code_parent_id, category_id code_val, category_name code_txt, 'folder' code_icon from category order by code_txt;" },
        "default": { "sql": "select category_id from category where category_parent_id is null order by category_name limit 1" },
        "controlparams": { "expand_all": true },
        "onchange": "XPage.Select({ modelid: 'FieldUnbound_Tree_Category', onCancel: undoChange })",
        "controlstyle": "display:inline-block;margin-right:10px;height:400px;width:300px;"
      },
      {
        "control": "subform",
        "target": "FieldUnbound_Tree_Category",
        "bindings": { "category_id": "category_id" },
        "caption": "",
        "actions": "BIUD",
        "controlstyle": "width:450px;display:inline-block;"
      }
    ]
  },
  "FieldUnbound_Tree_Category": {
    "table":"category",
    "layout":"form",
    "onecolumn":true,
    "popup":[500,150],
    "caption": ["Category", "Categories"],
    "fields": [
      {"name": "category_id", "caption": "Category ID", "control": "label"},
      {"name": "category_name", "caption": "Category Name", "control": "textbox", "validate": ["Required"]},
      {"name": "category_parent_id", "control": "hidden"}
    ]
  }
}