Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
--scenario

@model IEnumerable<Tesco.RetalixTenNFR.MVC.Models.AutSearchViewModel>

@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<body>
    <script src="~/Scripts/jquery-1.8.2.min.js"></script>
    <script src="@Url.Content("~/Scripts/jquery.jstree.js")" type="text/javascript"></script>
    <link href="@Url.Content("~/Scripts/themes/default/style.css")" rel="stylesheet" type="text/css" />
    <div id="tree" style="height: 300px; width: 200px; float: left; overflow: scroll">
        <ul id="Tree1">
            @foreach (var item in Model)
            {
                if (item.Parent == "null")
                {
                
                <li>
                    <label for="@item.Unit">@item.Names</label>
                    <ul id="Tree2">
                        @foreach (var node in Model.Where(x => x.Parent == @item.Unit))
                        {
                            <li>
                                <input type="checkbox" name="CategorySelectList" 
                       id="@node.Unit" value="@node.Unit" />
                                <label for="@node.Unit">@node.Names</label>
                            </li>
                        }
                    </ul>

                </li>
           
                }
            }
        </ul>

    </div>

</body>
</html>
<script type="text/javascript">
    $(function () {
        $("#tree").jstree({
            "plugins": ["themes", "html_data", "checkbox", "ui"]

        });

    });
</script>


--Treeview is working properly but the doubt is as below.

--"plugins": ["themes", "html_data", "checkbox", "ui"].
Though I have mentioned checkbox, but still the checkbox is not coming. Where I am doing wrong. Inside the foreach I have mentioned the checkbox. I want to get rid of those input checkbox and get the checkbox from the plugin.

--Kindly help
Posted
Updated 22-Oct-19 23:18pm
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900