ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Issue with treeView in Frappe-Datatable


#1

I am not able to get data in datatable’s tree view. This is the code

const assets = [
"/assets/frappe/css/frappe-datatable.css",
"/assets/frappe/js/lib/clusterize.min.js",
"/assets/frappe/js/lib/Sortable.min.js",
"/assets/frappe/js/lib/frappe-datatable.js",
]
frappe.require(assets, () => {


let dt = new DataTable('#hello', {
  columns: [
    { name: 'Files', width: 300 },
    { name: 'Size', width: 150, align: 'right' },
    { name: 'Last Updated', width: 200, align: 'right' },
  ],
  data: [
    {
      'Files': 'Documents',
      'Size': '2M',
      'Last Updated': '',
      'indent': 0
    },
    {
      'Files': 'project.pdf',
      'Size': '1M',
      'Last Updated': 'Yesterday',
      'indent': 1
    },
    {
      'Files': 'my-face.png',
      'Size': '500k',
      'Last Updated': '2018-04-09',
      'indent': 1
    },
    {
      'Files': 'Projects',
      'Size': '77M',
      'Last Updated': '',
      'indent': 0
    },
    {
      'Files': 'frappe-gantt',
      'Size': '23M',
      'Last Updated': '',
      'indent': 1
    },
    {
      'Files': 'dist',
      'Size': '50k',
      'Last Updated': '2018-06-01',
      'indent': 2
    },
    {
      'Files': 'package.json',
      'Size': '5k',
      'Last Updated': '2018-06-01',
      'indent': 2
    },
    {
      'Files': 'frappe-datatable',
      'Size': '54M',
      'Last Updated': '',
      'indent': 1
    },
    {
      'Files': 'src',
      'Size': '53k',
      'Last Updated': 'A few seconds ago',
      'indent': 2
    },
  ],
  treeView: true
});


})

Although, the same code is working on fiddle. I am unable to figure out any library is missing or whats the issue that data isn’t showing. Note-> Already have clusterize and sortable libraries.


#2

Am I missing something. Any suggestions ?
There is a parameter format:formatFileName which I can’t get how it actually is supposed to be used. Tried with some combinations like Treeview,treeView,‘treeView’, none worked. Any help/suggestions will be appreciable


#3

Any help ?


#4

Still facing with the same issue. :frowning: Any update/help please