setTimeout(function(){ //.... },0)
方法会加入执行的栈中,简单的说就是异步操作
在渲染中,做最后一次数据转换的时候,可以大量使用
比如在easyui中,你可以这样,用以同步进行数据样式的转换
            $("#tb").datagrid({
                columns: [
                    [{
                        field: ‘bookId‘,
                        title: ‘书名‘,
                        formatter: function(value, row, index) {
                            return $.conver("book",value);
                        }
                    }]
                ]
            })
也可以这样,异步进行数据的转换
            $("#tb").datagrid({
                columns: [
                    [{
                        field: ‘bookName‘,
                        title: ‘书名‘,
                        formatter: function(value, row, index) {
                            setTimeout(function() {
                                $("#tb").datagrid(‘updateRow‘, {
                                    index: index,
                                    row: {
                                        "bookName": $.conver("book",value)
                                    }
                                },0)
                            })
                        }
                    }]
                ]
            })
原文:http://www.cnblogs.com/liuCy/p/4623371.html