• ASP.NET ZERO 学习 JTable的ChildTable用法


    效果图:

    Jtable的子表用法:

    _$masterTable.jtable({
                title: app.localize('PharmacyInventory'),
                openChildAsAccordion: true,
                paging: true,
                actions: {
                    listAction: {
                        method: _masterService.getItems
                    }
                },
    
                fields: {
                    id: {
                        key: true,
                        list: false
                    },
                    //...
                    details: {
                        title: '',
                         '3%',
                        sorting: false,
                        edit: false,
                        create: false,
                        display: function (data) {
                            var master = data.record;
                            var $span = $('<span></span>');
                            var $btnView = $('<button class="btn btn-default btn-xs" title="' + app.localize('Details') + '"><i class="fa fa-align-justify"></i></button>')
                            .appendTo($span)
                            .click(function () {
                                $('#MasterTable').jtable('openChildTable',
                                $btnView.closest('tr'),
                                {
                                    title: master.medicineName + "(" + master.pinYin + ")",
                                    actions: {
                                        listAction: {
                                            method: _masterService.getSubItems
                                        }
                                    },
                                    fields: {
                                        productionDate:
                                        {
                                            title: app.localize('ProductionDate'),
                                             '10%',
                                            display: function (data) {
                                                var $span = $('<span></span>');
                                                $span.append(moment(data.record.productionDate).format('YYYY-MM-DD')+ " &nbsp; ");
                                                return $span;
                                            }
                                        },
                                        period:
                                        {
                                            title: app.localize('Period'),
                                             '10%'
                                        },
                                        effectiveDate: {
                                            title: app.localize('EffectiveDate'),
                                             '15%',
                                            display: function (data) {
                                                var $span = $('<span></span>');
                                                $span.append('<label class="font-red bold">' + moment(data.record.effectiveDate).format('YYYY-MM-DD') + "</label> &nbsp; ");
                                                return $span;
                                            }
                                        },
                                        batchNo: {
                                            title: app.localize('BatchNo'),
                                             '10%',
                                            display: function (data) {
                                                var $span = $('<span></span>');
                                                $span.append(data.record.batchNo + " &nbsp; ");
                                                return $span;
                                            }
                                        },
                                        stockBalance: {
                                            title: app.localize('PharmacyInventory'),
                                             '10%',
                                            display: function (data) {
                                            var $span = $('<span></span>');
                                            $span.append('<label class="font-red bold">' + data.record.stockBalance + "</label> &nbsp; ");
                                            return $span;
                                            }
                                        }
                                    }
                                }, function (data) {
                                    data.childTable.jtable('load', {
                                        sourceId: master.medicineID
                                    });
                                });
                            });
                            return $span;
                        }
                    },
                    medicineName: {
                        title: app.localize('MedicineName'),
                         '15%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.medicineName + "(" + data.record.pinYin + ")" + " &nbsp; ");
                            return $span;
                        }
                    },
                    category: {
                        title: app.localize('Category'),
                         '10%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.categoryText + " &nbsp; ");
                            return $span;
                        }
                    },
                    dosage: {
                        title: app.localize('Dosage'), 
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.dosageText + " &nbsp; ");
                            return $span;
                        }
                    },
                    spec: {
                        title: app.localize('Spec'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.specText + " &nbsp; ");
                            return $span;
                        }
                    },
                    minPacking: {
                        title: app.localize('MinPacking'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.minPackingText + " &nbsp; ");
                            return $span;
                        }
                    },
                    unit: {
                        title: app.localize('Unit'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.unitText + " &nbsp; ");
                            return $span;
                        }
                    },
                    limitation: {
                        title: app.localize('Limitation'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.limitation + " &nbsp; ");
                            return $span;
                        }
                    },
                    usage: {
                        title: app.localize('Usage'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.usageText + " &nbsp; ");
                            return $span;
                        }
                    },
                    route: {
                        title: app.localize('Route'),
                         '7%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append(data.record.routeText + " &nbsp; ");
                            return $span;
                        }
                    },
                    stockBalance: {
                        title: app.localize('PharmacyInventory'),
                         '10%',
                        display: function (data) {
                            var $span = $('<span></span>');
                            $span.append('<label class="font-red bold">' + data.record.stockBalance + "</label> &nbsp; ");
                            return $span;
                        }
                    }
                }
            });

    参考链接:http://www.codeproject.com/Articles/277576/AJAX-based-CRUD-tables-using-ASP-NET-MVC-and-jTa

  • 相关阅读:
    java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.views.login_jsp
    安装eclipse插件,很慢终于找到了解决的方法
    开发辅助网站---programcreek
    java--遇到NoSuchMethodError通用解决思路
    详解SpringBoot 添加对JSP的支持(附常见坑点)
    springboot 配置jsp支持
    JS前端取得并解析后台服务器返回的JSON数据的方法
    ajax接收json数据到js解析
    1 problem was encountered while building the effective model [FATAL] Non-parseable POM F:MavenRepositoryorgapachemavenpluginsmaven-resources-plugin2.6maven-resources-plugin-2.6.pom: start tag
    新装mvn建第一个项目报错org.apache.maven.plugins:maven-resources-plugin:2.6
  • 原文地址:https://www.cnblogs.com/fanxingthink/p/6000228.html
Copyright © 2020-2023  润新知