Confusion Regarding dataSrc when using rowGroup (New to Datatables)
Confusion Regarding dataSrc when using rowGroup (New to Datatables)
park_bud
Posts: 2Questions: 1Answers: 0
Hi Friends,
I'm using razor cshtml and datatables although the data is loading perfectly i'm unable to group the data using rowGroup and i have confusion on how to use dataSrc for my type of code which is mentioned below.Would be of great help if could get some guidance Thank you
@using SRS.CMS.BLL.AppModels.Model;
@using SRS.CMS.Infra;
@model CaneWeightmentResultModel
@if (Model.DeductionReportDtoList != null)
{
<table id="DeductionReport" class="display cell-border" width="100%" cellspacing="0">
<thead>
<tr>
<th>FN</th>
<th>Token No</th>
<th>Tripsheet Number</th>
<th>slip Number</th>
<th>Plantation Code</th>
<th>Cutting Order Number</th>
<th>Village Name</th>
<th>H Code</th>
<th>Harvestor name</th>
<th>T Code</th>
<th>Transporter name</th>
<th>Vehicle number</th>
<th>Deduction Type</th>
<th>Net Weight</th>
<th>Deduction Percentage</th>
<th>Farmer Net Weight</th>
<th>Tare Weight Date</th>
</tr>
</thead>
@if (Model.DeductionReportDtoList != null)
{
foreach (var itemCode in Model.DeductionReportDtoList)
{
<tr>
<td style="text-align:left">@itemCode.F_NAME</td>
<td style="text-align:left">@itemCode.TOKEN_NUMBER</td>
<td style="text-align:left">@itemCode.TRIPSHEET_NUMBER</td>
<td style="text-align:left">@itemCode.SLIP_NUMBER</td>
<td style="text-align:left">@itemCode.PLANTATION_CODE</td>
<td style="text-align:left">@itemCode.CUTTING_ORDER_NUMBER</td>
<td style="text-align:left">@itemCode.VILLAGE_NAME</td>
<td style="text-align:left">@itemCode.H_CODE</td>
<td style="text-align:left">@itemCode.HARVESTOR_NAME</td>
<td style="text-align:left">@itemCode.T_CODE</td>
<td style="text-align:left">@itemCode.TRANSPORTER_NAME</td>
<td style="text-align:left">@itemCode.VEHICLE_NUMBER</td>
<td style="text-align:left">@itemCode.DEDUCTION_TYPE</td>
<td style="text-align:left">@itemCode.NET_WEIGHT</td>
<td style="text-align:left">@itemCode.DEDUCTION_PERCENTAGE</td>
<td style="text-align:left">@itemCode.FARMER_NET_WEIGHT</td>
<td style="text-align:left">@itemCode.TARE_WEIGHT_DATE</td>
</tr>
}
}
</table>
}
<script>
$(document).ready(function () {
var table = $('#DeductionReport').DataTable({
rowGroup: {
dataSrc: ? // confusion
}
});
});
</script>
Answers
I'm using razor cshtml and datatables although the data is loading perfectly i'm unable to group the data using rowGroup and i have confusion on how to use dataSrc for my type of code which is mentioned above Would be of great help if could get some guidance I tried accessing the elements but could not get the value