Datatable编辑树形模态框

e引入文件

<script type="text/javascript" src="{:PUBLICS}js/proTree/js/proTree.js"></script> 

html

            <div aria-hidden="true" role="dialog" tabindex="-1" id="model_tree" style="z-index: 1051;" class="modal fade">

                <div class="modal-dialog">

                    <div class="modal-content">

                        <div class="modal-header">

                            <button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>

                            <h4 class="modal-title">选择项目</h4>

                        </div>

                        <section class="panel">

                            <div class="innerUl ">

                            </div>

                            <!-- <div id="tree_content" class=""></div> -->

                        </section>

                    </div>

                </div>

            </div>

Js


_fieldTypes.treeModal= {

                        create: function(conf) {

                            conf._enabled = true;

                            var id = Editor.safeId(conf.id);

                            conf._input = $('<input id="' + id + '" style="cursor: pointer;" readonly="readonly"  type="text" class="form-control" data-id=' + id + '>');

                            conf._input.click(function() {

                                $("#modal_tree").modal();

                            });

                            return conf._input;

                        },

                        get: function(conf) {

                            return conf._input.val();

                        },

                        set: function(conf, val) {

                            conf._input.val(val);

                        },

                        enable: function(conf) {

                            conf._enabled = true;

                        },

                        disable: function(conf) {

                            conf._enabled = false;

                        }

                    };


{

                                "label": "系列",

                                "name": "hqq_goods.category_id",

                                "type": "treeModal"

 }



 $(document).on('click', '.buttons-create,.buttons-edit', function() {

                        var category_length = $('.innerUl').html();

                        var texture_length = $('.Texture_content').html();

                        if (category_length.length == 29 && texture_length.length == 29) {

                            var arr;

                            //加载编辑框内的 分类以及材质

                            $.ajax({

                                url: "{:url('hqqGoods/getCategoryList')}",

                                method: "post",

                                success: function(e) {

                                    category = e['category'];

                                    texture = e['texture'];

                                    $(".innerUl").ProTree({

                                        arr: category,

                                        close: true,

                                        simIcon: "fa fa-file-o", //单个标题字体图标 不传默认glyphicon-file

                                        mouIconOpen: "fa fa-folder-open-o", //含多个标题的打开字体图标  不传默认glyphicon-folder-open

                                        mouIconClose: "fa fa-folder-o", //含多个标题的关闭的字体图标  不传默认glyphicon-folder-close

                                        callback: function(id, name) {

                                            $.ajax({

                                                url: "{:url('hqqGoods/checkChooseLowest')}",

                                                method: 'POST',

                                                data: {

                                                    table: 'hqq_classify',

                                                    pid: id

                                                },

                                                success: function(e) {

                                                    if (e === 1) {

                                                        editor.field("hqq_goods.category_id").val(name);

                                                        $("#modal_jModal").modal("hide");

                                                    } else alert('点击小图标显示下一级');

                                                }

                                            })

                                        }

                                    })


                                }

                            });

                        }


 $(document).on('click', '.enter_user_model', function() {

                        var value = $('.searchable-select-holder').html();

                        editor.field("hqq_goods.uid").val(value);

                        $("#model_User").modal("hide");

                    });

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容