主页

fastadmin表格跳转另外一个表格并传值

落墨秋满怀   IP属地: 青海
0 点赞 0阅读 1833

先在表格添加一个自定义属性

{field: 'id', title: '查看课程', operate: false,formatter: Controller.api.formatter.checkLesson},

添加checkLesson方法

 checkLesson: function (value, row, index) {
                    //这里手动构造URL
                    var url = "";
                    var type = row.type;
                    if(type==1){
                        url='lesson/series?id='+value
                    }else if(type==2){
                        url='lesson/accompany?id='+value
                    }else if(type==3){
                        url='lesson/live?id='+value
                    }else if(type==4){
                        url='lesson/overt?id='+value
                    }
                   
                    //方式一,直接返回class带有addtabsit的链接,这可以方便自定义显示内容
                    return '<a href="' + url + '" class="label label-success addtabsit" title="' + '查看课程' + '">' +'查看课程' + '</a>';

                    //方式二,直接调用Table.api.formatter.addtabs
                    return Table.api.formatter.addtabs(value, row, index, url);
                }


完整代码截图:



© 著作权归作者所有,转载或内容合作请联系作者