or
<
script
>
$(document).ready(function () {
var crudServiceBaseUrl = "http://localhost/IqaRestService/Service1",
dataSource = new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/getquestions",
dataType: "json"
},
update: {
url: crudServiceBaseUrl + "/update",
dataType: "json",
type: "POST",
contentType: "application/json"
},
create: {
url: crudServiceBaseUrl + "/create",
dataType: "json",
type: "POST",
contentType: "application/json"
},
destroy: {
url: crudServiceBaseUrl + "/delete",
dataType: "json",
type: "DELETE",
contentType: "application/json"
},
parameterMap: function (options, operation) {
if (operation !== "read" && options) {
return kendo.stringify({ question: options });
}
}
},
schema: {
model: {
id: "QuestionId",
fields: {
QuestionId: { type: "string" },
QuestionText: { type: "string" },
Comment: { type: "string" },
Answer: { type: "string" }
}
}
}
});
$(".k-add-button").click(function (e) {
listView.add();
e.preventDefault();
});
var listView = $("#listView").kendoListView({
dataSource: dataSource,
editable: true,
selectable: "single",
template: kendo.template($("#template").html()),
editTemplate: kendo.template($("#editTemplate").html())
}).data("kendoListView");
});
</
script
>
[OperationContract]
[WebGet(ResponseFormat = WebMessageFormat.Json, UriTemplate =
"/getquestions"
)]
public
List<IqaQuestion> GetQuestions()
{
return
this
.Store;
}
[OperationContract]
[WebInvoke(Method =
"POST"
, UriTemplate =
"/update"
, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public
bool
SaveQuestion(IqaQuestion question)
{
return
true
;
}
[OperationContract]
[WebInvoke(Method =
"POST"
, UriTemplate =
"/create"
, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public
bool
CreateQuestion(IqaQuestion question)
{
return
true
;
}
[OperationContract]
[WebInvoke(Method =
"DELETE"
, UriTemplate =
"/delete"
, BodyStyle = WebMessageBodyStyle.WrappedRequest)]
public
bool
RemoveQuestion(IqaQuestion question)
{
return
false
;
}
column.Bound(o => o.Color).Title("Color").Filterable(filterable => filterable.UI("colorFilter"));
function colorFilter(element) {
element.kendoDropDownList({
dataSource: {
transport: {
read: "@Url.RouteUrl("ProductData", new { action = "FilterMenuCustomization_Colors", controller = "Inventory", catagory = "XYZ" })"
, type: "POST"
, data: { catagory: "@ViewData["productType"].ToString()", filters: $("#Products").data.filter }
}
},
optionLabel: "--Select Value--"
});
}
@(Html.Kendo().Grid<DSG.Support.EntityModel.Models.SolutionFeedback>()
.Name(
"KBFeedbackGrid"
)
.Columns(columns =>
{
columns.Bound(
"solution_id"
).Title(
"KB#"
);
columns.Command(act => act.Custom(
"Edit"
));
columns.Bound(
"site_id"
).Title(
"Acc ID"
);
columns.Bound(
"site_name"
).Title(
"Account Name"
);
columns.Bound(
"rating_score"
).Title(
"Rating"
).HtmlAttributes(
new
{ @
class
=
"ratingCol"
});
columns.Bound(
"date_time"
).Title(
"Created"
).Format(
"{0:MM/dd/yyyy HH:mm}"
);
columns.Bound(
"comments"
).Title(
"Comment"
);
columns.Bound(
"action_taken"
).Title(
"Action"
);
})
.DataSource(dataSource => dataSource.Ajax()
.Read(read => read.Action(
"Query"
,
"KBFeedback"
).Data(
"GetSearchCriteria"
))
.Sort(sort => sort.Add(x => x.date_time))
)
.Pageable()
.Sortable(sort => sort.AllowUnsort(
false
).Enabled(
true
).SortMode(GridSortMode.SingleColumn))
)
public
JsonResult Query(DataSourceRequest request, KBFeedbackSearchCriteria query)
{
// Here request contains the page number and page size but the Sorts collection is null
int
count = 42;
// Get count from linq query
IEnumerable<SolutionFeedback> results =
null
;
// Get data from linq query
return
Json(
new
DataSourceResult() { Data = results, Total = count }, JsonRequestBehavior.AllowGet);
}
@Scripts.Render("~/bundles/modernizr")
<!--This bundle was moved by the Kendo UI VS Extensions for compatibility reasons-->
@Scripts.Render("~/bundles/jquery")
<!--This CSS entry was added by the Kendo UI VS Extensions for compatibility reasons-->
<
link
href
=
"@Url.Content("
~/Content/kendo.compatibility.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2012.3.1315/kendo.common.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2012.3.1315/kendo.dataviz.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2012.3.1315/kendo.default.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
link
href
=
"@Url.Content("
~/Content/kendo/2012.3.1315/kendo.dataviz.default.min.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2012.3.1315/jquery.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2012.3.1315/kendo.all.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo/2012.3.1315/kendo.aspnetmvc.min.js")"></
script
>
<
script
src
=
"@Url.Content("
~/Scripts/kendo.modernizr.custom.js")"></
script
>