У меня есть метод контроллера следующим образом < /p> [code][HttpGet] public JsonResult GetClientAccount([DataSourceRequest] DataSourceRequest request, string partyId) { try { using (var client = GetWebClient(WebClientContentType.JSON)) { string clientApiResponse = client.DownloadString(new Uri(_webApiUrl + "/api/Client/GetClientAccountinfo/" + partyId)); var rawResponse = JsonConvert.DeserializeObject(clientApiResponse); ClientAccountJsonViewModel clientInfo = JsonConvert.DeserializeObject(rawResponse);
if (clientInfo?.Data == null || !clientInfo.Data.Any()) { return Json(new DataSourceResult { Data = new List(), Total = 0 }, JsonRequestBehavior.AllowGet); }
var clientAccs = clientInfo.Data .Select(data => new ClientAccountInvoice { Description = data.InvoiceDescription, InvoiceNumber = data.InvoiceNumber ?? "" }) .AsQueryable(); // Convert to IQueryable for server-side operations
// Apply server-side operations (filtering, sorting, paging) var result = clientAccs.ToDataSourceResult(request);
// The Total is automatically set by ToDataSourceResult based on filtered count return Json(result, JsonRequestBehavior.AllowGet); } } catch (Exception ex) { // Log error return Json(new DataSourceResult { Data = new List(), Total = 0 }, JsonRequestBehavior.AllowGet); } } < /code> my cshtml выглядит следующим образом < /p>
$("#grid").kendoGrid({ dataSource: { transport: { read: { url: "/Client/GetClientAccount", type: "GET", dataType: "json", data: function () { return { partyId: $(".clientnumber-text").text().trim() }; } } }, serverPaging: true, serverSorting: true, serverFiltering: true, columns: [{ field: "InvoiceNumber", title: "Invoice No" }], pageSize: 20, // Adjust as needed schema: { data: "Data", total: "Total" } }, columns: [ { field: "Description", filterable: false, title: "Description", width: "200px" }, { field: "InvoiceNumber", title: "InvoiceNumber", width: "120px", template: "#if(TransactionType && InvoiceNumber && InvoiceNumber.trim() != '' && InvoiceNumber != '0') {#" + "#=InvoiceNumber#" + "#} else {# #=InvoiceNumber# #} #" }, ], pageable: true, sortable: true, filterable: true }); [/code] Но когда я применяю фильтр на InvoiceNumber, я не могу видеть, что на стороне сервера
У меня есть базовая сетка, которая использует функцию встроенной редактирования. Моя цель - использовать комбо -поле для обеспечения соблюдения конкретного значения, которое можно сохранить. Тем не менее, я не уверен, что мне не хватает, так как...