or
$(
"#grid"
).kendoGrid({
dataSource: {
type:
"json"
,
transport: {
read:
"http://localhost:8888/mysite/xml/sample.json"
},
schema: {
model: {
fields: {
id: { type:
"number"
},
data: { type:
"json"
}
}
}
},
pageSize: 5
},
height: 250,
pageable:
true
,
columns: [{
field:
"id"
,
title:
"Record ID"
,
filterable:
false
},
{
field:
"data"
,
title:
"Data String"
}
],
});
[
{
"id"
:0,
"data"
:[
{
"source"
:
"Lotus Domino XML Mail"
,
"title"
:
"Mr SYDPER"
,
"path"
:
"/NSF//Marketing/Travel Itininery"
}
]
},
{
"id"
:1,
"data"
:[
{
"source"
:
"Lotus Domino XML Mail"
,
"title"
:
"Re: CMI statement for"
,
"path"
:
"/Marketing/Mark"
}
]
}
]
dataSource =
new
kendo.data.DataSource({
type:
"json"
,
serverPaging:
true
,
serverSorting:
true
,
serverFiltering:
false
,
error:
function
(e) {
// display custom error
},
...
});
success:
function
(data) {
var
that =
this
,
options = that.options,
hasGroups = options.serverGrouping ===
true
&& that._group && that._group.length > 0;
data = that.reader.parse(data);
if
(that._handleCustomErrors(data)) {
// should dequeue request!
// that._dequeueRequest();
return
;
}
...
that._dequeueRequest();
// only called if any data is retrived
that._process(that._data);
}
$(
#treview)
.removeClass(
'k-treeview'
)
.empty();
$(
#treeview).kendoTreeView({
dataSource: getNewdata(),
select: onNodeSelect
})
;
<script type=
"text/javascript"
language=
"javascript"
>
$(document).ready(
function
() {
$(
"#grid"
).kendoGrid(
{
groupable:
true
,
scrollable:
true
,
sortable:
true
,
pageable:
true
,
filterable:
true
,
dataSource: {
type:
"json"
,
transport: {
read: {
url:
"/Item/GetItems"
,
type:
"POST"
,
dataType:
"json"
,
contentType:
"application/json; charset=utf-8"
}
}
},
columns: [
{ field:
"ID"
, title:
"ID"
},
{ field:
"InvNo"
, title:
"Инв.номер"
}
]
});
});
</script>
public
JsonResult GetItems()
{
List<SelectListItem> searchParams =
new
List<SelectListItem>();
searchParams.Add(
new
SelectListItem() { Value =
"InvNo"
, Text =
"121"
});
IList<Item> data = _itemService.GetItems(searchParams);
return
Json(data.ToList(), JsonRequestBehavior.AllowGet);
}
$(
'#grid'
).kendoGrid({
height: 520,
sortable:
true
,
pageable:
true
,
groupable:
true
,
dataSource:
new
kendo.data.DataSource({
serverPaging:
true
,
serverSorting:
false
,
pageSize: RecebimentoAutomatico.Configuracoes.RegistrosPorPagina,
transport: {
read: {
url:
function
() {
return
UrlComParametros() },
contentType:
'application/json; charset=utf-8'
}
},
schema: { data:
'dados'
, total:
'total'
}
}),
columns: [
{ field:
'IdentificadorProcessamento'
, title:
' '
, template:
'<input type="checkbox" value="#=IdentificadorProcessamento#">'
, width: 30, sortable:
false
},
{ field:
'NumeroNota'
, title:
'N° da Nota'
, width: 60 },
{ field:
'DataEmissao'
, title:
'Data Emissão'
, width: 100 },
{ field:
'DataEntrada'
, title:
'Data Entrada'
, width: 95 },
{ field:
'NomeFornecedor'
, title:
'Parceiro'
, width: 300, template:
'<span rel="tooltip" title="#=NomeFornecedor#">#=NomeFornecedor#</span>'
},
{ field:
'EstruturaValida'
, title:
'Consulta NFe Nacional'
, width: 100, template:
'<div style="text-align: center;"><i class="icon-24 icon-efisc-restricted"></i></div>'
},
{ field:
'EstruturaValida'
, title:
'Integridade do XML'
, width: 100, template:
'<div style="text-align: center;"><i class="icon-24 # if(EstruturaValida == true) { #icon-efisc-check#}else{#icon-efisc-error#}#"></i> <a href="#=UrlDetalhesValidacao#" title="Ver detalhes da validação" href=""><i class="icon-24 icon-efisc-lupa"></i></a></div>'
},
{ field:
'ValidaNaSefaz'
, title:
'Válido na Sefaz'
, width: 100, template:
'<div style="text-align: center;"><i class="icon-24 # if(ValidaNaSefaz == true) { #icon-efisc-check#}else{#icon-efisc-error#}#"></i> <a href="#=UrlDetalhesValidacao#" title="Ver detalhes da validação" href=""><i class="icon-24 icon-efisc-lupa"></i></a></div>'
},
{ field:
'ValidaNoSystax'
, title:
'Válido no Systax'
, width: 100, template:
'<div style="text-align: center;"><i class="icon-24 # if(ValidaNoSystax == true) { #icon-efisc-check#}else{#icon-efisc-error#}#"></i> <a href="#=UrlDetalhesSystax#" title="Ver detalhes da validação" href=""><i class="icon-24 icon-efisc-systax"></i></a></div>'
},
{ field:
'ValidaNoValidate'
, title:
'Válido no Validate'
, width: 105, template:
'<div style="text-align: center;"><i class="icon-24 # if(ValidaNoValidate == true) { #icon-efisc-check#}else{#icon-efisc-error#}#"></i> <a href="#=UrlDetalhesValidateReceita#" target="_blank" title="Ver detalhes da RFB" href=""><i class="icon-24 icon-efisc-rfb"></i></a><a href="#=UrlDetalhesValidateSintegra#" target="_blank" title="Ver detalhes do Sintegra" href=""><i class="icon-24 icon-efisc-sintegra"></i></a></div>'
},
{ field:
'ChaveNFe'
, title:
'Integração'
, width: 180, template: sapTemplate },
{ field:
'UrlVisualizar'
, title:
'NFe'
, width: 50, template:
'<a href="#=UrlVisualizar#" title="Visualizar Nota Fiscal Eletrônica"><i class="icon-24 icon-efisc-lupa"></i></a><a href="#=UrlVisualizarImpressao#" title="Visualizar Nota Fiscal Eletrônica para Impressão"><i class="icon-24 icon-efisc-printer"></i></a>'
},
{ command: { text:
"Details"
, className:
"details-button"
}, title:
" "
, width:
"110px"
}
],
dataBound:
function
() {
if
(
this
.dataSource.group().length == 0) {
setTimeout(
function
() {
$(
".k-grouping-header"
).html(
"Arraste uma coluna aqui para agrupar"
);
});
}
//Inicia tooltips
$(
'#grid span'
).tooltip();
MostraTotal();
}
});
@using (Html.BeginForm("Index", "CodeManager"))
{
<
p
>
<
label
for
=
"startsWith"
>
<
strong
>Category:</
strong
></
label
>
@Html.DropDownList("Classifications", ViewData["ClassificationItems"] as SelectList, new { style = "width:100px;" })
<
button
type
=
"submit"
class
=
"u-button"
>
Search</
button
>
</
p
>
}
@if (Model.Count() > 0)
{
@(Html.Kendo().Grid(Model)
.Name("CodeManager")
.Columns(columns =>
{
columns.Bound(p => p.CodeID);
columns.Bound(p => p.Title);
columns.Bound(p => p.Status);
columns.Command(command => { command.Edit(); }).Width(200);
})
.ColumnMenu()
.ToolBar(toolBar => toolBar.Create().Text("Add New Code"))
.Sortable()
.Scrollable()
.Groupable()
.Pageable()
.Filterable()
.Selectable(selectable => selectable.Mode(GridSelectionMode.Multiple))
.Resizable(resize => resize.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.ServerOperation(false)
.Model(model => model.Id(p => p.Id))
.Update(update => update.Action("Code", "CodeManager", new { classifications = @ViewBag.SelectedCatgory }))
.Create(create => create.Action("Code", "CodeManager"))
)
.Editable(ed => ed.Mode(GridEditMode.PopUp))
)
}
else
{
@Html.Label("No records matched search criteria.");
}
@model hrmsMVC.Areas.HRMS.Models.CodeModel
<
fieldset
>
<
legend
>Code</
legend
>
@Html.HiddenFor(model => model.CodeID)
<
div
class
=
"editor-label"
>
@Html.LabelFor(model => model.CodeID)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(model => model.CodeID)
@Html.ValidationMessageFor(model => model.CodeID)
</
div
>
<
div
class
=
"editor-label"
>
@Html.LabelFor(model => model.Title)
</
div
>
<
div
class
=
"editor-field"
>
@Html.EditorFor(model => model.Title)
@Html.ValidationMessageFor(model => model.Title)
</
div
>
<
div
class
=
"editor-field"
>
@Html.DisplayFor(model => model.Status)
</
div
>
</
fieldset
>
public class CodeModel
{
[Key]
[ScaffoldColumn(false)]
public int Id { get; set; }
[DisplayName("Code ID")]
[Required(ErrorMessage = "Code is required.")]
[StringLength(2, ErrorMessage = "Code can be at most 2 characters")]
public string CodeID { get; set; }
[Required]
public string Title { get; set; }
[HiddenInput(DisplayValue = false)]
public string Status { get; set; }
public bool Active { get; set; }
public string Category { get; set; }
[ScaffoldColumn(false)]
public int UserID { get; set; }
}
public ActionResult Index(string classifications = "")
{
ViewData["Classifications"] = new SelectList(Classifications.List, "ClassificationText", "ClassificationText", classifications);
var criterion = new Criterion("Category", Operator.Equals, classifications);
var codeModels = new List<
CodeModel
>();
ViewBag.SelectedCatgory = classifications ?? "Type";
if (Request.HttpMethod == "POST")
{
// var model = _codeRepository.Search(classifications).ToModel();
var model = _codeRepository.GetList(criterion).ToModel();
return View(model);
}
return View(codeModels);
}