anurag19289 Ответов: 0

Плагин Checkbox не работает в Jstree


--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 работает нормально, но сомнение, как показано ниже.

--"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

0 Ответов