Show Posts
|
|
Pages: [1]
|
|
1
|
General Category / EasyUI for jQuery / Re: Treegrid for asp.net and web method
|
on: October 03, 2012, 03:57:16 AM
|
ok guys. i've just found solution to my own question  i have changed the javascript getServerData function like this; function getServerData(param, success, error) { main_id = param.id; isRoot = false; if (main_id == undefined) { isRoot = true; main_id = '94'; } jQuery.ajax({ type: "POST", url: '/WebForm1.aspx/treeTest', data: JSON.stringify({ mainId: main_id }), contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { var oColumns = new Array(); if (isRoot) oColumns = { rows: jQuery.parseJSON(data.d) }; else oColumns = jQuery.parseJSON(data.d); success(oColumns); }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); }
and it's done! 
|
|
|
|
|
2
|
General Category / EasyUI for jQuery / Treegrid for asp.net and web method
|
on: October 03, 2012, 12:16:03 AM
|
Hi everyone. I'm tying to implement easyui treegrid into my asp.net application. I get the main nodes shown in grid. but the child nodes are not shown. this is the javascript code; $('#tt').treegrid({ loader: function(param, success, error) { getServerData(param, success, error); }, idField: 'InSysProjectTask', treeField: 'StTitle', frozenColumns: [[ { field: 'StTitle', title: 'StTitle', width: 200, formatter: function(value) { return '<span style="color:red">' + value + '</span>'; } } ]], columns: [[ { title: 'InSysProjectTask', field: 'InSysProjectTask', hidden: true}, { field: 'InMainSysProjectTask', title: 'InMainSysProjectTask', hidden:true }, { title: 'StDetail', field: 'StDetail', width: 40, formatter: function(value) { return '<img src="/images/comment.png" title="' + value + '"/>'; } }, { title: 'StFullName', field: 'StFullName', width: 80 }, { title: 'InIsMilestone', field: 'InIsMilestone', width: 80 }, { title: 'InStatus', field: 'InStatus', width: 80 }, { title: 'DtDueDate', field: 'DtDueDate', width: 80 }, { title: 'DtEndDate', field: 'DtEndDate', width: 80 }, { title: 'DtStartDate', field: 'DtStartDate', width: 80 }, { title: 'InEstimatedWork', field: 'InEstimatedWork', width: 80 } ]] });
function getServerData(param, success, error) { main_id = param.id; if (main_id == undefined) main_id = '94'; jQuery.ajax({ type: "POST", url: '/WebForm1.aspx/treeTest', data: JSON.stringify({ mainId: main_id }), contentType: "application/json; charset=utf-8", dataType: "json", success: function(data) { var oColumns = { rows: jQuery.parseJSON(data.d) }; success(oColumns); }, error: function(jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); }
and below the web service [System.Web.Services.WebMethod] public static string treeTest(string mainId) { string cn = SqlConnectionHelper.ConnectionString; string sqlStr = "SELECT tl.InSysProjectTask, tl.InMainSysProjectTask, tl.StTitle, " + " isNull(tl.StDetail, '') StDetail, convert(varchar, tl.DtDueDate, 104) DtDueDate, u.StFullName, InIsMilestone " + " ,InStatus, convert(varchar, DtEndDate, 104) DtEndDate, convert(varchar, DtStartDate, 104) DtStartDate, InEstimatedWork, " + "CASE WHEN (SELECT count(tsp.InSysProjectTask) FROM TbSysProjectTask tsp WHERE tsp.InMainSysProjectTask = tl.InSysProjectTask)>0 THEN 'closed' ELSE 'open' END AS [state]" + " FROM TbSysProjectTask tl " + " Left join TbUsers u on u.InUserId = tl.InResponsibleId " + " WHERE tl.InSysTicketProjectId=" + "13" + " AND tl.InSubProjectId=" + "94" + " AND tl.InMainSysProjectTask = " + mainId;
DataSet ds = SqlHelper.ExecuteDataset(cn, CommandType.Text, sqlStr); return GetJson(ds.Tables[0]); }
this is what i got;  and this is when i try to get child nodes;  any help?
|
|
|
|
|