Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

File manager app script / resources?


Hi Sean / team / et al..

In the demos you provide an example layout for a file manager:
https://preview.keenthemes.com/metronic8/demo20/apps/file-manager/files/.html

I looks to be built off dataTables, with some mods. Also, within the HTML you reference "data-kt-filemanager-table", which I can see indicates some JS getElementBy method that I've located as a library in the custom/apps/file-manager/list section of the demo files. It looks fully fledged, but I'm having troubles understanding how your scripts are handling folders vs files.

Is there some smarts in the file list script that is treating folders differently (a dataTable feature), or is the link for a folder object used to re-get/AJAX a new list of items for the dataTable?

I ask because dataTables has the ability to grab a list of items and paginating these (keeping them in DOM and managing client side) without needing server side calls for every new page. However, I'm not sure if or how that could be done for folders.

Am I missing something? Does your app/file-manager/list.js script handle folders different to files all at the client-side, or do I need to customise the script to make a new server-side call when a user clicks on a folder item?

Much appreciated


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (5)


Hi,

You can take a look at the JS file. The file is located here;
src/js/custom/apps/file-manager/list.js

The datatable loads the hardcoded table from HTML files, similar to this datatable init method https://datatables.net/examples/basic_init/zero_configuration.html

You can check the file with the HTML table here;
- html/demo1/dist/apps/file-manager/folders.html
- html/demo1/dist/apps/file-manager/files.html

We do not use server-side data sources for datatable. You have to customize it to make it server-side.

Thanks



Hi Faizal

Thanks - but it doesn't get to the nub of my question.

I've got no problems using server side, and I understand how dataTables works. However, I'm not clear on the customisation that Metronic layers on top.

Specifically, how *Metronic's customised file manager script* "custom/apps/file-manager/list.js" deals with folders vs files. It currently has a separate tableconfig variable: const foldersListOptions = {}

I'm assuming that somewhere in Metronics, which I'm overlooking, that it looks at the filepath retrieved from the DB, (ie a literal path is returned from the query "path\uploadFolders\pictures\img.png", that Metronic script would replicates a folder structure in dataTables based on the query returned path text.

If this is not the case, then I'll need to create a script that does this.. but I didn't want to start re-inventing the wheel if it's already in the Metronic scripts.

Can you confirm if there's some functionality in the Metronic scripts in how it layers over the dataTables library, to manage file paths as folders?

Thanks



Hi,

If you take a look at the example list in the HTML file here;
/html/demo1/dist/apps/file-manager/files.html

Look for the table id "kt_file_manager_list". You can see here that table content is hard coded in the table. We do not use a server-side data source. You will need to create a script to get the files/folders list from db.



Thanks



Ok thanks for confirming.

However, I don't think the demo hard coded pages are the basis for determining this. I know all the items displayed in the demos are hard coded. I have downloaded and am working on the packages.

However, the hard coded pages are relevant for the compiled demo versions only, and do not reflect accurately on the full capability from the src folders (before consolidating with gulp/webpack). There are a ton of helper scripts and the demos don't fully reflect all the capability of the scripts.

(In the demo, these helper scripts are compiled into the global script. )

The helper scripts go *above and beyond* the hard coding of the demo HTML pages. In many cases, I've been able to use the Metronic scripts to achieve a bunch of things *beyond* what the demo pages do. However, in order to achieve this, I've had to go line by line through the Metronic scripts, which is tricky and massively time consuming.



Hi,

Thanks for your feedback. We will take them into account in a future update.

Agree, Metronic has a bunch of custom scripts most for demonstration purposes. Those custom scripts written for the apps or pages are supposed to be used as a starting point or reference for the provided UI and it's up to the user to use them as a base or refactor to the specific project needs.

However, our Gulp/Webpack builders allow reducing the bundle size by removing unused plugins as explained here.

I would suggest you customize your build and keep only required plugins in scripts.bundle.js and style.bundle.css and custom scripts you can revise, adapt, and include pages on demand, those custom js of apps, pages are not bundled in the global bundle.

If you need any further assistance please let us know.

Regards.


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(