Question

Funny question, but i honestly can't acces (for example) the CKFinder.dataTypes.Folder: http://docs.cksource.com/ckfinder_2.x_api/symbols/CKFinder.dataTypes.Folder.html.

I have downloaded the CKFinder 2.x demo for asp.net to try the utility out and the only thing intellisense is giving me access to is the window.CKFinder object and some of its methods, but nothing else. I couldn't find Folder in ckfinder.js either.

Was it helpful?

Solution

As stated in the Documentation you may not be able to access it directly, instead you should call any Folder API function once CKFinder object has been loaded.

Note: the CKFinder.dataTypes namespace is not directly accessible (CKFinder.dataTypes is undefined). Data types are used internally by CKFinder and returned by many functions, like CKFinderAPI#getSelectedFolder.


The following example is an initialization in javascript of the CKFinder component which shows how to access the Folder datatype.

<script type="text/javascript">
    var finder = new CKFinder();
    finder.basePath = '/js/ckfinder/'; // The path for the installation of CKFinder (default = "/ckfinder/").
    // Setting custom width and user language.
    finder.width = '99%';
    finder.defaultLanguage = 'es';
    finder.language = 'es';

    finder.removePlugins = 'basket';
    //finder.selectActionFunction = showFileInfo;
    //finder.resourceType = 'Images';
    //finder.tabIndex = 1;
    //finder.startupPath = "Images:/";

    finder.callback = function( api ) 
    {
        api.openMsgDialog( "", "Almost ready to go!" );
        api.hideTool( "f2" );//hide flash folder
        api.openFolder('Images', '/');
        var folder = api.getSelectedFolder();
        //console.debug(folder);
        folder.createNewFolder( 'New Folder' );
        //api.setUiColor('white');
    };
    var api = (finder).create();

    //console.debug(api);
    //api.openMsgDialog("Sample title","Sample message."); //doesnt work here, CKFinder still not loaded.
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top