locked
JsTree With Data From Database RRS feed

  • Question

  • User-698989805 posted

    Hello friends! I am trying to learn JsTree and found a solution that I require. Here is the link that I am checking now:

    JsTree Sample

    This looks perfect and what I am expecting is to do it with server-side using C# SQL Server. Anyone worked with it earlier or any code samples are there that I can use on my end? Would expect some quick suggestions on this and much appreciated - Thanks.

    Monday, April 29, 2019 5:21 AM

All replies

  • User753101303 posted

    Hi,

    Have you tried https://www.jstree.com/docs/json/which shows which kind of json data returned by your server could be used to populate the tree. Try maybe https://www.c-sharpcorner.com/article/working-with-json-in-mvc/ if you need to see how json with MVC works.

    Or depending on your data, a first step could be to render "theTree" from server side data rather than having this hardcoded in your HTML page. BTW you are using MVC or Web Forms?

    It's always best to be explicit about the very first problem you have when trying to do something so that we can better understand which kind of help you need (it's a bit harder when having no idea at all about your current skill level).

    Monday, April 29, 2019 10:01 AM
  • User-698989805 posted

    Hello @PatriceSc! I prefer to use ASP.NET MVC and worked with jSon earlier but not in depth. Could you provide a sample same as the JsFiddle now if possible?

    Monday, April 29, 2019 10:38 AM
  • User475983607 posted

    Your question is too vague to answer and seems to encompass the entire .NET stack.  What exact;y do you need help with?  Can you at least provide the code you have tried, explain the expected results, and explain the actual results.

    Monday, April 29, 2019 11:06 AM
  • User-698989805 posted

    Hello @mgebhard! Thanks for the reply and unfortunately I didn't try anything yet but would be trying to do it myself. My requirement is to show category details in a TreeView, finally can drag and drop product details to it. In the example, there is a TreeView and a Table or Div. See the below again:

    Sample JsTree

    So when I drag a product to the Table or Div from the TreeView, then it should be visible to the Table or Div section only. But not to the TreeView, please see the sample again. Finally the vice-versa could be done. I was just trying to do it in the database-level and believe, this should require few Ajax call to make the changes. Whenever I change a product to a different category, this would be changed in the database as well.

    Thursday, May 2, 2019 5:21 AM