dataTables对象数据的展现问题
2016-06-24 14:25
274 查看
datables处理带"."的数据做了一些特殊处理
前端JavaScript
后台返回的数据格式必须为:
datatables的源码在1274行,代码为
我的解决方案
返回的数据格式为:
{creator.name: "张三", creator.email: "zhangsan@xx.com", creator.mobilePhonoeNumber: "1333333333"}
需要把dataTables的代码注释掉才能展示数据 阅读更多
前端JavaScript
columns: [
{data: "creator.name",title: "创建者", defaultContent: "", width: 120,align: "left"},
{data: "creator.email",title: "创建者邮箱", defaultContent: "", width: 120, align: "left"},
{data: "crea 4000 tor.mobilePhoneNumber",title: "创建者手机", defaultContent: "", width: 120, align: "left"}
]
后台返回的数据格式必须为:
creator:{name: "张三", email: "zhangsan@xx.com", mobilePhonoeNumber: "1333333333"}
datatables的源码在1274行,代码为
//else if ( typeof mSource === 'string' && (mSource.indexOf('.') !== -1 ||
// mSource.indexOf('[') !== -1 || mSource.indexOf('(') !== -1) )
//{
// /* If there is a . in the source string then the data source is in a
// * nested object so we loop over the data for each level to get the next
// * level down. On each loop we test for undefined, and if found immediately
// * return. This allows entire objects to be missing and sDefaultContent to
// * be used if defined, rather than throwing an error
// */
// var fetchData = function (data, type, src) {
// var arrayNotation, funcNotation, out, innerSrc;
//
// if ( src !== "" )
// {
// var a = _fnSplitObjNotation( src );
//
// for ( var i=0, iLen=a.length ; i<iLen ; i++ )
// {
// // Check if we are dealing with special notation
// arrayNotation = a[i].match(__reArray);
// funcNotation = a[i].match(__reFn);
//
// if ( arrayNotation )
// {
// // Array notation
// a[i] = a[i].replace(__reArray, '');
//
// // Condition allows simply [] to be passed in
// if ( a[i] !== "" ) {
// data = data[ a[i] ];
// }
// out = [];
//
// // Get the remainder of the nested object to get
// a.splice( 0, i+1 );
// innerSrc = a.join('.');
//
// // Traverse each entry in the array getting the properties requested
// if ( $.isArray( data ) ) {
// for ( var j=0, jLen=data.length ; j<jLen ; j++ ) {
// out.push( fetchData( data[j], type, innerSrc ) );
// }
// }
//
// // If a string is given in between the array notation indicators, that
// // is used to join the strings together, otherwise an array is returned
// var join = arrayNotation[0].substring(1, arrayNotation[0].length-1);
// data = (join==="") ? out : out.join(join);
//
// // The inner call to fetchData has already traversed through the remainder
// // of the source requested, so we exit from the loop
// break;
// }
// else if ( funcNotation )
// {
// // Function call
// a[i] = a[i].replace(__reFn, '');
// data = data[ a[i] ]();
// continue;
// }
//
// if ( data === null || data[ a[i] ] === undefined )
// {
// return undefined;
// }
// data = data[ a[i] ];
// }
// }
//
// return data;
// };
//
// return function (data, type) { // row and meta also passed, but not used
// return fetchData( data, type, mSource );
// };
//}
我的解决方案
返回的数据格式为:
{creator.name: "张三", creator.email: "zhangsan@xx.com", creator.mobilePhonoeNumber: "1333333333"}
需要把dataTables的代码注释掉才能展示数据 阅读更多
相关文章推荐
- Application对象的使用-数据传递以及内存泄漏问题
- springMVC对简单对象、Set、List、Map的数据绑定和常见问题(三)
- Mybatis使用generatedKey在插入数据时返回自增id始终为1,自增id实际返回到原对象当中的问题排查
- Android笔记 Application对象的使用-数据传递以及内存泄漏问题
- C++中 没有数据成员的类的对象所占的内存空间大小问题
- BeanUtils主要解决 的问题: 把对象的属性数据封装 到对象中
- Android笔记 Application对象的使用-数据传递以及内存泄漏问题
- 黑马程序员----浅谈RandomAccessFile格式化数据问题和多个对象序列化存取的两个方法
- springMVC之对象中的基本类型数据绑定遇到的问题
- 对象调用私有成员数据问题
- Application对象的使用-数据传递以及内存泄漏问题 和使用Memory Analyzer tool(MAT)
- QML与c++交互学习笔记(六) 关于qt c++中创建对象,QML获取此对象数据问题
- Silverlight中的TabControl如何绑定数据?重写tabcontrol和tabItem 解决绑定友好问题。可以绑定对象集合
- Android笔记 Application对象的使用-数据传递以及内存泄漏问题
- 解决数据不能更新,数据库或对象为只读的问题[图]
- 在juqery的ajax和struts2整合开发时,对象数据的从页面到Action的传递问题
- javascript中创建对象,并序列化为json,通过$.ajax的提交json数据到后台方法,取值为null的问题
- List使用add方法添加对象-只显示最后添加的数据的问题
- 关于java的一些小问题,list中添加对象,java基本数据类型对象
- Oracle插入数据时出现ORA-01950:对象空间‘XXX’无权限问题