with programmatically element of javascript

3974
4
Jump to solution
03-08-2015 12:52 AM
yousofothman
New Contributor III

hi

every body

i want example that add shape file to the map

but all element on page must be created programmatically with dojo

i try this:

 _addShapeFile: function (tool, toolbar, panelClass) {






            var ShapeFileDiv = toolbar.createTool(tool, panelClass);
            domStyle.set(ShapeFileDiv, {
                "height": "100%",
                "width": "100%"
            });
            //var newDiv1 = document.createElement("div");


            //document.getElementById("newDiv1").appendChild(ShapeFileDiv);
            ////newDiv1.appendChild(ShapeFileDiv);
            var file = document.createElement("INPUT");
            file.setAttribute("type", "file");


            var uploadForm = dojo.place("<form> Add shapefile as .zip file </form>", ShapeFileDiv);


            domConstruct.place(file, uploadForm);


            var ShapeFilebutton = domConstruct.create("button", {
                innerHTML: "Add FIle ",
                className: "button",
                type: "button",
                style: { color: "red" }
            }, domConstruct.create("div", {
                "class": "button11"
            }));

this code create button and upload file on form but i could not add the uploaded file to the map

any help please

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Yousof,

   Then you need to look at JS Shapefile library like this one:

mbostock/shapefile · GitHub

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Yousof,

   See this sample: Add shapefile | ArcGIS API for JavaScript

0 Kudos
yousofothman
New Contributor III

thank you for replying but this sample create all element in html where i want it programmatically

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yousof,

   Then you need to look at JS Shapefile library like this one:

mbostock/shapefile · GitHub

yousofothman
New Contributor III

thank you

0 Kudos