{"hidden":false,"children":[{"configs":{"serverScript":"//演示通过代码方式获取键值，sexKey在客户端initialize事件中声明\napp.set({\n  sexKey: StringUtil.text(com.wb.common.KVBuffer.getList('sex'))\n});","itemId":"module"},"expanded":true,"children":[{"configs":{"layout":"fit","itemId":"viewport1"},"expanded":true,"children":[{"configs":{"itemId":"grid1"},"expanded":true,"children":[{"configs":{"itemId":"store","autoLoad":"true","url":"m?xwl=examples/controls/grid/data-source/select-employee"},"expanded":false,"children":[],"type":"store"},{"configs":{"itemId":"columns"},"expanded":true,"children":[{"configs":{"itemId":"numCol","xtype":"rownumberer"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"generalCol","text":"常规"},"expanded":true,"children":[{"configs":{"itemId":"realNameCol","renderer":"var sex = record.get('SEX');\nreturn Wb.getIcon(record.get('SEX') == '2' ? 'user1_icon' : 'user_icon', sex) + value;","dataIndex":"REAL_NAME","width":"180","text":"姓名"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"sexCol","renderer":"//演示使用代码方式转换键值\nmetaData.tdAttr = 'style=\"background:coral;\"';\nreturn Wb.kv(value, app.sexKey); //app.sexKey请参考module的serverScript和initialize属性","dataIndex":"SEX","keyName":"@'sex'/*仅用于导出*/","width":"50","text":"性别"},"expanded":false,"children":[],"type":"column"}],"type":"column"},{"configs":{"itemId":"birthDateCol","renderer":"if (value && value.getFullYear() < 1950) {\n  metaData.style = 'background-color:red;';\n  return '<span style=\"color:white\">' + Wb.dateToText(value) + '<\/span>';\n} else\n  return Wb.dateToText(value);","dataIndex":"BIRTH_DATE","text":"生日"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"vacationHoursCol","renderer":"value = value || 0;\nreturn '<div style=\"width:100px;border:1px solid blue;background-color:gray;\"><div style=\"width:' +\n  value + 'px;color:white;background-color:blue;\"><span class=\"wb_glyph\">&#xf017;<\/span>&nbsp;' + value +\n  'h<\/span><\/div><\/div>';","dataIndex":"VACATION_HOURS","width":"110","text":"休假时长"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"linkCol","renderer":"//调用module.initialize内定义的hrefMethod方法\nreturn '<a method=\"hrefMethod\" onclick=\"Wb.invoke(this,' + rowIndex + ');\" href=\"javascript:void(0);\">调用方法<\/a>';","text":"超链接调用","align":"center"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"buttonCol","renderer":"return '<button type=\"button\" method=\"hrefMethod\" onclick=\"Wb.invoke(this,' + rowIndex + ');\">启动<\/a>';","text":"按钮调用","align":"center"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"actionColumns","xtype":"actioncolumn","width":"50","align":"center"},"expanded":true,"children":[{"configs":{"itemId":"items"},"expanded":true,"children":[{"configs":{"itemId":"addAction","handler":"Wb.toast('添加：' + record.data.REAL_NAME);","tooltip":"添加","iconCls":"record_add_icon"},"expanded":false,"children":[],"type":"column"},{"configs":{"itemId":"delAction","handler":"Wb.toast('删除：' + record.data.REAL_NAME);","tooltip":"删除","iconCls":"delete_icon"},"expanded":false,"children":[],"type":"column"}],"type":"array"}],"type":"column"}],"type":"array"},{"configs":{"itemId":"viewConfig","getRowClass":"//Wb预定义行背景色种类：wb_red_row, wb_green_row, wb_blue_row, wb_yellow_row, wb_hotpink_row, wb_gold_row, wb_bisque_row, wb_aqua_row\n//样式在style.css中预定义，如果需要动态加载css文件请参考m?xwl=examples/basic/link/dynamic-link示例\nvar cls, hours = record.get('VACATION_HOURS');\nif (hours >= 90)\n  cls = 'wb_gold_row';\nelse if (hours >= 80)\n  cls = 'wb_aqua_row';\nelse cls = '';\nreturn cls;"},"expanded":false,"children":[],"type":"tableview"}],"type":"grid"}],"type":"viewport"}],"type":"module","events":{"initialize":"app.sexKey = Wb.decode(\"{#sexKey#}\"); //必须使用双引号，因为sexKey经由StringUtil.text方法引用\napp.hrefMethod = function(rowIndex) {\n  //var html=this.innerHTML;//this指向点击的dom\n  Wb.warn('姓名：' + app.grid1.store.getAt(rowIndex).data.REAL_NAME);\n};\napp.buttonMethod = function(rowIndex) {\n  Wb.warn('姓名：' + app.grid1.store.getAt(rowIndex).data.REAL_NAME);\n};"}}],"roles":{"demo":1},"title":"高亮","iconCls":"","inframe":false,"pageLink":""}