var myTree= new GridTree();
/**
* 主要的测试方法
*/function test()
{
var GridColumnType = [
{
header: 'id',
headerIndex: 'MissionBaseID',
columntype: {
inputtype: 'html',
htmlStr: '<button onclick="alert(\'$\');">$</button>',
nameId: 'textbox'
}
}, {
header: 'MissionName',
headerIndex: 'MissionName',
columntype: {
inputtype: 'html',
htmlStr: '<button onclick="alert(\'$\');">$</button>',
nameId: 'textbox'
}
}];
var content = { columnModel: GridColumnType,
//data: [{ 'MissionBaseID': '3', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '2', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '0', 'MissionLevel': '1', 'MissionTrigger': 'asdfffff', 'MissionDesc': 'dddddddddddddddd', 'MissionName': '斩杀华雄' }, { 'MissionBaseID': '4', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '1', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '0', 'MissionLevel': '1', 'MissionTrigger': '111', 'MissionDesc': '1111', 'MissionName': '斩杀华仔' }, { 'MissionBaseID': '5', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '4', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '1', 'MissionLevel': '2', 'MissionTrigger': '121', 'MissionDesc': '212', 'MissionName': '去买军粮' }, { 'MissionBaseID': '6', 'MissionType1': '2', 'MissionType2': '2', 'MissionType3': '2', 'Virtual': '2', 'Subtask': '0', 'Country': '3', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '1', 'MissionLevel': '21', 'MissionTrigger': '1212', 'MissionDesc': '1212121', 'MissionName': '买球'}],
dataUrl:'http://localhost:8112/WebSite/gridTree/Ajax.aspx',
idColumn: 'MissionBaseID', //id所在的列,一般是主键(不一定要显示出来)
parentColumn: 'ParentMissionBaseID', //父亲列id
rowCountOption: 3,
height: '100px',
rowCount: true, //是否自动计算行数
checkOption: 2, //1:出现单选按钮,2:出现多选按钮,其他:不出现选择按钮
allCheck: true, //如果是多选,可以选择是否出现全部选择的按钮
debug: true,
pageBar: true,
styleOption: 1,
pageSize: 3,
//disabeld:true,//为true就表示表格中的文本域,多选框等为不可编辑状态
disableOptionColumn: 'rddisbled', //用来标识指定的选择框是否禁用的属性,默认没有
chooesdOptionColumn: 'rddisbled', //用来标识默认的就选择多选框的属性,在有多选的选按钮的情况时候有用.
multiChooseMode: 3,
//expandAll:true,//展开全部
tableId: 'testTable', //表格树的id
el: 'newtableTree'//要进行渲染的div id
};
myTree.loadData(content);
myTree.makeTable();
//展开全部节点
_$('bt3').onclick=function(){myTree.expandAll();};
//展开第一层节点
_$('bt4').onclick=function(){myTree.closeAll();};
}/**
* 双击事件,双击一行调用该方法.
* @param {行对象} obj
*/
function doubleClickOnRow(obj)
{
debugObjectInfo(obj);
}/**
* 用来查看一个对象的属性
*/
function debugObjectInfo(obj){
traceObject(obj);
function traceObject(obj){
var str = '';
if(obj.tagName&&obj.name&&obj.id)
str="<table border='1' width='100%'><tr><td colspan='2' bgcolor='#ffff99'>traceObject tag: <"+obj.tagName+"> name = '"+obj.name+"' id = '"+obj.id+"' </td></tr>";
else{
str="<table border='1' width='100%'>";
}
var key=[];
for(var i in obj){
key.push(i);
}
key.sort();
for(var i=0;i<key.length;i++){
var v= new String(obj[key[i]]).replace(/</g,"<").replace(/>/g,">");
if(typeof obj[key[i]]=='string'&&v!=null&&v!='')
str+="<tr><td valign='top'>"+key[i]+"</td><td>"+v+"</td></tr>";
}
str=str+"</table>";
writeMsg(str);
}
function trace(v){
var str="<table border='1' width='100%'><tr><td bgcolor='#ffff99'>";
str+=String(v).replace(/</g,"<").replace(/>/g,">");
str+="</td></tr></table>";
writeMsg(str);
}
function writeMsg(s){
traceWin=window.open("","traceWindow","height=600, width=800,scrollbars=yes");
traceWin.document.write(s);
}
}function showHtml()
{
jQuery('#ans').text(jQuery('#newtableTree').html());
}function setGridTreeDisabled(v){
myTree.setDisabled(v);
}function showChoosed()
{
var ans = getAllCheckValue();
if(ans!='')
alert(ans);
else
alert('没有选择');
}function openAll()
{
myTree.expandAll();
}function closeAll()
{
myTree.closeAll();
}
上面注释的DATA数据和 AJAX.aspx一样的。为什么我用DATAurl就不可以呢。为什么实在搞不明白。G.CN没找到
/**
* 主要的测试方法
*/function test()
{
var GridColumnType = [
{
header: 'id',
headerIndex: 'MissionBaseID',
columntype: {
inputtype: 'html',
htmlStr: '<button onclick="alert(\'$\');">$</button>',
nameId: 'textbox'
}
}, {
header: 'MissionName',
headerIndex: 'MissionName',
columntype: {
inputtype: 'html',
htmlStr: '<button onclick="alert(\'$\');">$</button>',
nameId: 'textbox'
}
}];
var content = { columnModel: GridColumnType,
//data: [{ 'MissionBaseID': '3', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '2', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '0', 'MissionLevel': '1', 'MissionTrigger': 'asdfffff', 'MissionDesc': 'dddddddddddddddd', 'MissionName': '斩杀华雄' }, { 'MissionBaseID': '4', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '1', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '0', 'MissionLevel': '1', 'MissionTrigger': '111', 'MissionDesc': '1111', 'MissionName': '斩杀华仔' }, { 'MissionBaseID': '5', 'MissionType1': '1', 'MissionType2': '1', 'MissionType3': '1', 'Virtual': '1', 'Subtask': '0', 'Country': '4', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '1', 'MissionLevel': '2', 'MissionTrigger': '121', 'MissionDesc': '212', 'MissionName': '去买军粮' }, { 'MissionBaseID': '6', 'MissionType1': '2', 'MissionType2': '2', 'MissionType3': '2', 'Virtual': '2', 'Subtask': '0', 'Country': '3', 'Pre_MissionBaseID': '0', 'Pre_NPC': '0', 'Post_NPC': '0', 'ParentMissionBaseID': '1', 'RootMissionBaseID': '1', 'MissionLevel': '21', 'MissionTrigger': '1212', 'MissionDesc': '1212121', 'MissionName': '买球'}],
dataUrl:'http://localhost:8112/WebSite/gridTree/Ajax.aspx',
idColumn: 'MissionBaseID', //id所在的列,一般是主键(不一定要显示出来)
parentColumn: 'ParentMissionBaseID', //父亲列id
rowCountOption: 3,
height: '100px',
rowCount: true, //是否自动计算行数
checkOption: 2, //1:出现单选按钮,2:出现多选按钮,其他:不出现选择按钮
allCheck: true, //如果是多选,可以选择是否出现全部选择的按钮
debug: true,
pageBar: true,
styleOption: 1,
pageSize: 3,
//disabeld:true,//为true就表示表格中的文本域,多选框等为不可编辑状态
disableOptionColumn: 'rddisbled', //用来标识指定的选择框是否禁用的属性,默认没有
chooesdOptionColumn: 'rddisbled', //用来标识默认的就选择多选框的属性,在有多选的选按钮的情况时候有用.
multiChooseMode: 3,
//expandAll:true,//展开全部
tableId: 'testTable', //表格树的id
el: 'newtableTree'//要进行渲染的div id
};
myTree.loadData(content);
myTree.makeTable();
//展开全部节点
_$('bt3').onclick=function(){myTree.expandAll();};
//展开第一层节点
_$('bt4').onclick=function(){myTree.closeAll();};
}/**
* 双击事件,双击一行调用该方法.
* @param {行对象} obj
*/
function doubleClickOnRow(obj)
{
debugObjectInfo(obj);
}/**
* 用来查看一个对象的属性
*/
function debugObjectInfo(obj){
traceObject(obj);
function traceObject(obj){
var str = '';
if(obj.tagName&&obj.name&&obj.id)
str="<table border='1' width='100%'><tr><td colspan='2' bgcolor='#ffff99'>traceObject tag: <"+obj.tagName+"> name = '"+obj.name+"' id = '"+obj.id+"' </td></tr>";
else{
str="<table border='1' width='100%'>";
}
var key=[];
for(var i in obj){
key.push(i);
}
key.sort();
for(var i=0;i<key.length;i++){
var v= new String(obj[key[i]]).replace(/</g,"<").replace(/>/g,">");
if(typeof obj[key[i]]=='string'&&v!=null&&v!='')
str+="<tr><td valign='top'>"+key[i]+"</td><td>"+v+"</td></tr>";
}
str=str+"</table>";
writeMsg(str);
}
function trace(v){
var str="<table border='1' width='100%'><tr><td bgcolor='#ffff99'>";
str+=String(v).replace(/</g,"<").replace(/>/g,">");
str+="</td></tr></table>";
writeMsg(str);
}
function writeMsg(s){
traceWin=window.open("","traceWindow","height=600, width=800,scrollbars=yes");
traceWin.document.write(s);
}
}function showHtml()
{
jQuery('#ans').text(jQuery('#newtableTree').html());
}function setGridTreeDisabled(v){
myTree.setDisabled(v);
}function showChoosed()
{
var ans = getAllCheckValue();
if(ans!='')
alert(ans);
else
alert('没有选择');
}function openAll()
{
myTree.expandAll();
}function closeAll()
{
myTree.closeAll();
}
上面注释的DATA数据和 AJAX.aspx一样的。为什么我用DATAurl就不可以呢。为什么实在搞不明白。G.CN没找到
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货