日期:2014-05-16  浏览次数:20352 次

关于JS,在for循环里使用switch产生的问题(easyui)
本帖最后由 maowendi123 于 2013-11-25 03:38:03 编辑

$.post("/EasyUI/actionInfo", {}, function (data) {
                for (var i = 0; i < data.length; i++) {
                    {
                        var item = data[i];
                        $("#dg").datagrid("addToolbarItem", [{ "text": item.ActionName, "iconCls": item.Icons, "handler": function () {
                          
                                switch (item.ActionName) {
                                    case '添加': alert("添加");
                                        break;
                                    case '修改': alert("修改");
                                        break;
                                    case '删除': alert("删除");
                                        break;
                                    default: alert("ddd");
                                
                            }
                        }
                        }, "-"]);
             &