FileManager: Initial Load

New User - evaluating the product.

Hi all,

I am trying to load the initial directory structure and having weird behavior.

D133938y [Root Folder]
Folder1 [Sub Folder of root]

Method #1: Using the Parse(). Not what I want but working.

$$(“files”).parse([{id:“D133938y”,value:“D133938y”,open:true,type:“folder”,date:new Date(2014,2,10,16,10),data:[{id:“Folder1”,value:“Folder1”,open:true,type:“folder”,date:new Date(2014,2,10,16,10)}]}])

Return: Proper directories

Method #2: URL calling AJAX Applet returning a json.

Return:
{“id”:“D133938y”,“value”:“D133938y”,“open”:true,“type”:“folder”,“date”:1450465634041,“data”:[{“id”:“Folder1”,“value”:“Folder1”,“open”:true,“type”:“folder”,“date”:1450465628156}]}

Result: Display only “Folder1”???

With more complex structure, the root is never displayed and missing files here and there.

Hi,

You need to load an array. Please check the structures you load via parse() and load(). It is an array for “parse” and an object for “load”

Thanks. When looking at the doc, always without bracket for json. Yes, work fine when wrapping with brackets.

For missing files, found out it was because of not having unique “Id”. Only the first will be keep and the other will be dropped.

Thanks for your help! :slight_smile:

When looking at the doc, always without bracket for json.

Could you please share the link to the articles with incorrect json format ? We will check and correct them.

http://docs.webix.com/file_manager__loading_data.html:

  • “id”: Specify that must be unique across the json, else will be ignored.

  • Provide a complete valid json.

    1. If using the Parse(): (not provided as a possibility here)
      $$(“files”).parse(
      [
      {
      id:“MyFolder”,
      value:“MyFolder”,
      open:true,
      type:“folder”,
      date:new Date(2014,2,10,16,10),
      data:
      [
      {
      id:“MySubFolder”,
      value:“MySubFolder”,
      open:true,
      type:“folder”,
      date:new Date(2014,2,10,16,10)
      }
      ]
      }
      ]
      );

    2. If using the “url” or load() [AJAX]:
      $$(“files”).load(“MyAJAX.php”);

      Must return following, including brackets:
      [
      {
      “id”:“MyFolder”,
      “value”:“MyFolder”,
      “open”:true,
      “type”:“folder”,
      “date”:1450464636,
      “data”:
      [
      {
      “id”:“MySubFolder”,
      “value”:“MySubFolder”,
      “open”:true,
      “type”:“folder”,
      “date”:1450464636
      }
      ]
      }
      ]

      Note:

      • Unlike the Parse(), the keys must be double quoted (id, value, …).
      • Date: Is number of seconds since 1/1/1970.
        • To convert a JAVA date : myDate.lastModified() / 1000 // Since JAVA is milliseconds since the beginnings.

    Note:
    - Should use a json on-line validator.