Example of creating the ImportDataWizard component

To execute the example, in the HEAD tag of the HTML page add links to the following JS and CSS files:

Add the DIV element with the div1 identifier in the BODY tag.

Add the following script in the SCRIPT tag:

    // Specify path to the root folder with resources files
    PP.resourceManager.setRootResourcesFolder("../resources/");
    PP.setCurrentCulture(PP.Cultures.ru);
    //on opening a repository
    function _onMetabaseOpened(sender, args) {
        //a corresponding message appears on the page
        document.getElementById("div1").innerHTML = document.getElementById("div1").innerHTML + "repository is open.";
    }
    //on successful import and on import with errors corresponding messages appear on the page
    function _onImportCompleted(sender, args) {
        document.getElementById("div1").innerHTML = document.getElementById("div1").innerHTML + "Import finished";
        if (args.CubeInfo)
            document.getElementById("div1").innerHTML = document.getElementById("div1").innerHTML + " successfully.Object identifier: " + args.CubeInfo.i + "<br/> File name: " + importDataWizard.getCubeImport().getFileName() + ".";
        else
            document.getElementById("div1").innerHTML = document.getElementById("div1").innerHTML + " with error. Error identifier: \"" + args.ErrorInfo.id + "\". Error text: \"" + args.ErrorInfo.message + "\"";
    }
    //repository connection
    var mb = new PP.Mb.Metabase(
	{
	    PPServiceUrl: "PPService.axd?action=proxy",
	    Id: "PPRepository",
	    UserCreds: { UserName: "user", Password: "password" }
	});
    document.getElementById("div1").innerHTML = "Opening repository...";
    mb.open(_onMetabaseOpened);
    //service used to work with import object
    var dataImportService = new PP.Mb.DataImportService({ Metabase: mb });
    //event is generated when import is completed
    dataImportService.ImportCompleted.add(_onImportCompleted, dataImportService);
    //create data import wizard
    var importDataWizard = new PP.Mb.Ui.ImportDataWizard({
        ParentNode: document.body,
        CubeImport: dataImportService.openCubeImport(),
        FileUploadUrl: "PPService.axd?action=import",
        DefaultImportFolderDesc: { k: 11574, i: null, n: null, c: 0 } // Place import result in the folder with the 11574 key     });     importDataWizard.show();     importDataWizard.updateSize();

After executing the example the data import wizard opens on the page. After the user follows all steps of the wizard and clicks Done on the last stage, the HTML page shows a message that informs if the import is successful or not.

See also:

ImportDataWizard