Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I had similar requirement, but i used ajax for Hierarchical information showing. It help me two ways. One the child information is loaded when requested. so i dont have to load all information on one go and also helped in multiple level Hierarchy.</p> <p>I used Jquery Datatable along with mvccontrib grid for pagination search and for Hierarchical data expand collapse link were introduced</p> <p><strong>Updated:</strong> In my exmple i have created first column with some concat information on first column which is required me to identify the row i have clicked. class .expand is to tell on click it should be expanded.a $.ajax call be made and information retrieved will be appended to the clicked row. expand/collapse are js method. you will see below this code.</p> <pre><code>&lt;%Html.Grid(Model) .Columns(column =&gt; {%&gt; &lt;% &lt;td&gt;&lt;a id="&lt;%= c.Desc %&gt;_&lt;%= c.No %&gt;" href="#" class="expand"&gt;&lt;/a&gt;&lt;/td&gt; &lt;% }).Attributes(c =&gt; new Dictionary&lt;string, object&gt; { { "padding-left", " 5px" } }); column.For(c =&gt; c.Date).Format("{0:dd/MM/yyyy}").Named("Date"); column.For(c =&gt; c.Desc).Named("Description"); }).Attributes(id =&gt; "example") .Empty("----------- No Ledger Details for current month/Search ----------- ").Render();%&gt; </code></pre> <p>I used jquery datatable for pagination and search in populated rows.and also used tabletool plugin for jquery datatable which help in exporting result to csv/xls/pdf. and copy pasting my content.</p> <pre><code> &lt;script language="javascript" type="text/javascript"&gt; $(document).ready(function () { $('#example').dataTable({ "sDom": 'T&lt;"clear"&gt;lfrtip', "bProcessing": true, "bPaginate": true, "sPaginationType": "full_numbers", "bFilter": true, "iDisplayLength": 10, "bSort": false, "oTableTools": { "sRowSelect": "multi", "sSwfPath": "../../../../Content/media/swf/copy_cvs_xls_pdf.swf", "aButtons": ["select_all", "select_none", "copy", "print", { "sExtends": "collection", "sButtonText": "Save", "aButtons": ["csv", "xls", "pdf"] }] } }); }); &lt;/script&gt; </code></pre> <p><strong>For collapse/Expand</strong></p> <pre><code>$("#example a.collapse").live('click', function (event) { event.preventDefault(); $(this).closest('tr').next().slideUp().remove(); $(this).removeClass("expand"); $(this).addClass("collapse"); }); $("#example a.expand").live('click', function (event) { event.preventDefault(); var parent = $(this).closest('tr'); var linkid = $(this).attr('id'); var parts = linkid.split("_"); var billNo = parts[1]; loadBillDetails(parent, billNo); $(this).removeClass("collapse"); $(this).addClass("expand"); }); function loadBillDetails(parent, billNo) { var defaultParameters = "{BillNo:" + billNo + "}"; $.ajax({ type: "POST", url: '&lt;%=Url.Action("GetBillDetails", "Order") %&gt;', data: defaultParameters, contentType: "application/json; charset=utf-8", dataType: "json", success: (function (data) { var str = "&lt;tr style='padding:5px;'&gt;&lt;td colspan=7&gt;&lt;div style='width: 850px; max-height: 300px; overflow: auto; background-color: #F4F4F4;'&gt;"; str += "&lt;table width='100%' id='billDetails'&gt;&lt;tr align='left'&gt;&lt;th&gt;BillNo&lt;/th&gt;&lt;th&gt;ProductName&lt;/th&gt;&lt;th&gt;OrderNo&lt;/th&gt;&lt;th&gt;RollNo&lt;/th&gt;&lt;th&gt;Qty&lt;/th&gt;&lt;th&gt;Rate&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;th&gt;&lt;/th&gt;&lt;/tr&gt;"; if (data.BillDetails.length &gt; 0) { for (var y = 0; y &lt; data.BillDetails.length; y++) { str += "&lt;tr&gt;&lt;td&gt;" + data.BillDetails[y].FinalBillNo + "&lt;/td&gt;&lt;td&gt;" + data.BillDetails[y].ProductName + "&lt;/td&gt;&lt;td&gt;" + data.BillDetails[y].OrderNo + "&lt;/td&gt;&lt;td&gt;" + data.BillDetails[y].RollsNo + "&lt;/td&gt;&lt;td&gt;" + data.BillDetails[y].Qty + "&lt;/td&gt;&lt;td&gt;" + data.BillDetails[y].Rate + "&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;"; } str += "&lt;/table&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;"; } else { str = "&lt;tr style='padding:7px;'&gt;&lt;td colspan=6&gt;No order found.&lt;/td&gt;&lt;/tr&gt;"; } var newRow = $(str); parent.after(newRow).slideDown(); }), error: (function () { parent.after("&lt;tr style='padding:5px;'&gt;&lt;td colspan=5&gt;An Error has occurred.&lt;/td&gt;&lt;/tr&gt;"); }) }); } }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload