Comments (9)
Thank you for your message. Please consider providing enough data for me to exactly replicate the possible bug which will enable me to look into it.
Note that after removing a child item (by clicking the delete button), you're not able to place it into same level as the parent anymore since the item has already been removed.
from domenu.
Glad you replied.I also have edited my issue. NOTE: I have added an extra field named "tagline"
My issue can be replicated by following the steps below:
The pic below shows the initial state of the menu and json data
JSON 1:
[{"title":"About Us","url":"http://demourl/about_us","tagline":"demo tagline","children":[{"title":"Services","url":"http://demourl/services","tagline":"asdf"}]},{"title":"Portfolio","url":"http://demorul/portfolio","tagline":"asdfa"},{"title":"Contact Us","url":"http://demourl/contact","tagline":"asdfads"}]
Step 1:
Move an item to create sub menu
JSON 2:
[{"title":"About Us","url":"http://demourl/about_us","tagline":"demo tagline change abt us","children":[{"title":"Services","url":"http://demourl/services","tagline":"asdf"}]},{"title":"Portfolio","url":"http://demourl/portfolio","tagline":"asdfa"},{"title":"Contact Us","url":"http://demourl/contact","tagline":"asdfads"}]
After making the above changes I stored the json record in the database.
Then again i retrieve records and my json data is the same as JSON 2. It renders fine when i pass it in $('#domenu').domenu({data: menuData}).parseJson();
Now the problem arises when i perform the next step
Step 3:
I moved the child back to its original position.
Now the json data is
JSON 3:
[{"title":"About Us","url":"http://demourl/about_us","tagline":"demo tagline change abt us","children":[{"title":"Services","url":"http://demourl/services","tagline":"asdf"}]},{"title":"Services","url":"http://demourl/services","tagline":"asdf"},{"title":"Portfolio","url":"http://demourl/portfolio","tagline":"asdfa"},{"title":"Contact Us","url":"http://demourl/contact","tagline":"asdfads"}]
NOTICE how services data is still persisting as a child even after moving the element.
Now this JSON Data will yield a menu as follows on rendering.
Finally:
You may also see in the first pic how the about us bears a "-" sign even if it doesn't have any children.This is most probably caused by ("children":) in the JSON 1 as i had previously created its child element and later moved/removed it.
THANK YOU AGAIN FOR THIS GREAT PLUGIN ENHANCEMENT AND HOPE TO HEAR SOON FROM YOU,CHEERS!!!
from domenu.
Hi thank you for your wonderful description of the problem, I was successfully able to replicate this problem and I've recognized it as a bug. I will patch this as soon as possible. Also, the ghost-child ('-' sign on empty parents) has already been solved in the next version of doMenu, which is about to get released soon.
from domenu.
Hi, this bug has been patched in the dev-version of the plugin. I will release the patched version to the public when I complete writing the release notes, however you can use the patched version right now if you're able to figure it out yourself how to use it (there is a working demo available and the files contain instructions in the comments). Please confirm the validity of the patch on your side, if possible.
from domenu.
Hi,it's me again.I integrated the developer version of your plugin and it does not work with JSON data i have mentioned above(NOTE: IT WORKS with the JSON data from the DEVELOPER VERSION).I would like to ask why you have added an "id" field for your items, I presume you used some logic identifying unique items to solve the child duplication issue.I also tried using the code below to add the unique id:
/</ input type="hidden" name="id" data-default-value="{?numeric.increment}" />/
But the problem here is it yields a string value and your plugin expects "id" field to be numeric I suppose.
THE STATIC JSON DATA YOU PASSED IN THE DEVELOPER DEMO IS:
[
{
"id": 11,
"title": "Flat Glass Preview",
"http": "",
"superselect": "2"
},
{
"id": 10,
"title": "News",
"http": "",
"superselect": "1"
},
{
"id": 9,
"title": "Categories",
"http": "",
"superselect": "1"
},
{
"id": 6,
"title": "Shop",
"http": "",
"children": [
{
"id": 5,
"title": "Glass",
"http": "",
"superselect": "1"
},
{
"title": "Other",
"superselect": "select something..."
}
],
"superselect": "select something..."
},
{
"id": 1,
"title": "About",
"http": "",
"superselect": "select something..."
}
]
THE JSON DATA I'm able to yield by adding the hidden input mentioned above is:
[
{
"title": "Item no. 3",
"tagline": "",
"id": "1",
"superselect": "http://demourl/portfolio/17"
},
{
"title": "Item no. 2",
"tagline": "",
"id": "2",
"superselect": "http://demourl/portfolio/17",
"children": [
{
"title": "Item no. 1",
"tagline": "",
"id": "3",
"superselect": "http://demourl/portfolio/17"
}
]
},
{
"title": "Item no. 1",
"tagline": "",
"id": "3",
"superselect": "http://demourl/portfolio/17"
},
{
"id": "4",
"title": "Item no. 0",
"http": "",
"superselect": "http://demourl/portfolio/17",
"tagline": ""
}
]
You may notice how the "id" values are string, so the child duplication problem still persists.
I really appreciate your help and I am thankful for the enhancement of custom fields I suggested.Cheers!!
from domenu.
Hi thank you for your reply. Note that the id property is added by default
without any explicit inputs in your blueprint. Please make sure to create a
correct blueprint template in your html markup (default
".dd-item-blueprint"). Also note that this standard id field is present in the previous versions as well.
On Sun, Nov 1, 2015 at 9:27 AM, Praneen Shakya [email protected]
wrote:
Hi,it's me again.I integrated the developer version of your plugin and it
does not work with JSON data i have mentioned above(NOTE: IT WORKS with the
JSON data from the DEVELOPER VERSION).I would like to ask why you have
added an "id" field for your items, I presume you used some logic
identifying unique items to solve the child duplication issue.I also tried
using the code below to add the unique id:
/</ input type="hidden" name="id"
data-default-value="{?numeric.increment}" />/But the problem here is it yields a string value and your plugin expects
"id" field to be numeric I suppose.THE STATIC JSON DATA YOU PASSED IN THE DEVELOPER DEMO IS:
[
{
"id": 11,
"title": "Flat Glass Preview",
"http": "",
"superselect": "2"
},
{
"id": 10,
"title": "News",
"http": "",
"superselect": "1"
},
{
"id": 9,
"title": "Categories",
"http": "",
"superselect": "1"
},
{
"id": 6,
"title": "Shop",
"http": "",
"children": [
{
"id": 5,
"title": "Glass",
"http": "",
"superselect": "1"
},
{
"title": "Other",
"superselect": "select something..."
}
],
"superselect": "select something..."
},
{
"id": 1,
"title": "About",
"http": "",
"superselect": "select something..."
}
]THE JSON DATA I'm able to yield by adding the hidden input mentioned above
is:
[
{
"title": "Item no. 3",
"tagline": "",
"id": "1",
"superselect": "http://demourl/portfolio/17"
},
{
"title": "Item no. 2",
"tagline": "",
"id": "2",
"superselect": "http://demourl/portfolio/17",
"children": [
{
"title": "Item no. 1",
"tagline": "",
"id": "3",
"superselect": "http://demourl/portfolio/17"
}
]
},
{
"title": "Item no. 1",
"tagline": "",
"id": "3",
"superselect": "http://demourl/portfolio/17"
},
{
"id": "4",
"title": "Item no. 0",
"http": "",
"superselect": "http://demourl/portfolio/17",
"tagline": ""
}
]You may notice how the "id" values are string, so the child duplication
problem still persists.I really appreciate your help and I am thankful for the enhancement of
custom fields I suggested.Cheers!!—
Reply to this email directly or view it on GitHub
#4 (comment).
from domenu.
Thank you for your reply. I had previously used the blue print template from your demo and have also reviewed it. I noticed that ADDING NEW MENU ITEMS THROUGH "+" button WONT yield "id" property while going through the JSON.
So i edited the JSON from your developer demo as
[
{
"title": "Flat Glass Preview",
"http": "",
"superselect": "2"
},
{
"title": "News",
"http": "",
"superselect": "1"
},
{
"title": "Categories",
"http": "",
"superselect": "1"
},
{
"title": "Shop",
"http": "",
"children": [
{
"title": "Glass",
"http": "",
"superselect": "1"
},
{
"title": "Other",
"superselect": "select something..."
}
],
"superselect": "select something..."
},
{
"title": "About",
"http": "",
"superselect": "select something..."
}
]
This then replicated the child duplication error.Thank you for your time.
from domenu.
Thank you for your reply. Please check the patch I've just pushed on the dev branch, and confirm its validity.
from domenu.
Thank you !! The latest patch solved the problem for me.
from domenu.
Related Issues (20)
- Dragging HOT 8
- Loading data using get_file_contents throws Uncaught SyntaxError: Unexpected token o HOT 5
- Additional functionality HOT 1
- prevent post inside form HOT 2
- Rewrite to Babel HOT 2
- after received json how to save data in database if child leave is more than 5-10 HOT 1
- how to find my json id HOT 4
- onItemRemoved function HOT 2
- Select2 dropdown selection selects option text instead of option value. HOT 2
- Cannot handle escape strings HOT 3
- your's domenu Nestable plugin is very useful for me thank you for this stuff. HOT 1
- Can we have different colors to elements? HOT 1
- I dont want to allow parent be child of anothe parent HOT 3
- doMenu in Form element not working HOT 2
- item-remove only needed at end child level HOT 1
- D in menu FIX HOT 2
- doMenu value of title and id field HOT 1
- how to display id along with title of one doMenu at other doMenu? HOT 1
- How can I call createNewListItem with parameters from outside domenu() plugin?
- property assigned to Menu item HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from domenu.