Kendo grid how to pass extra parameter from java script

in telerik extenstion to pass extra data to ajax request that I used

function onDataBinding(e)
{
    e.data = {argument : 4};
}

where is the e - div cointainer with the data object inside, How can I do this with kendo? I tried the same, but for Kendo e arqument it is completely different.

+3
source share
5 answers

Finally, I got the answer myself, and it:

$('#grid').data('kendoGrid').dataSource.Read({name:value})
+7
source

Sorry for the scary late night at the party, but I have a special cake that you can find delicious:

function readData()
{
    return {
        anagId: selectedItem.ID
    };
}

    $("#grid").kendoGrid({
        dataSource: {
            type: "ajax",
            transport: {
                read: {"url":"@Url.Action("RecordRead", "Tools")","data":readData} 
        }
       [ rest of the grid configuration]

I stumbled upon this code by checking out the code generated by the Kendo Asp.Net MVC helpers.

, , , , .

+3

1.add crud

.Read(read => read.Action("ReadCompanyService", "Admin").Data("CompanyServiceFilter")) 
  • javascript

    CompanyServiceFilter()       {

            return {
    
                company: $("#ServiceCompany").val()
    
            }
        } 
    
  • contorller

    public ActionResult ReadCompanyService ([DataSourceRequest]    DataSourceRequest, )   {

    var gridList = repository.GetCompanyServiceRateList(company)
     return Json(gridList.ToDataSourceResult(request));
    
    
    }
    

, , , .

Shaz

+2

ajax, .

Ajax.

,parameterMap: function (options, operation) {
                            if (operation === "read") {
                                var selectedID = $("#SomeElement").val();

                                return {ID: selectedID }

                            }
                            return  kendo.stringify(options.models) ;
                        }
+2

 .Read(read => read.Action("Controller", "Action")
       .Data(@<text>
                  function() {                                            
                                return {
                                            searchModel: DataFunctionName(),
                                            userName: '#=UserName#'
                                       }
                              }
               </text>)
               )

JS

function DataFunctionName() {
var   searchModel = {
                        Active: $("#activityMonitorIsActive").data('kendoDropDownList').value(),
                        Login: $("#activityMonitorUsers").data('kendoComboBox').value()
                    };
return searchModel;
}
+1

All Articles