or
<?PHPclass FileObj { public $name = ""; public $type = ""; public $size = "";}?><?include_once("obj.file.php");$path = $_GET["path"];$serverFilePath = "/home/midmosou/public_html/";$filter = "*.*";if(is_dir($serverFilePath . $path)){ foreach (glob($serverFilePath . $path . $filter) as $filename) { $file = new FileObj(); if (is_dir($filename)) { $file->name = basename($filename); $file->type = "d"; $file->size = "0"; } else { $file->name = basename($filename); $file->type = "f"; $file->size = filesize($filename); } $data[] = $file; } $count = count($data); echo "{\"data\":" .json_encode($data). ", \"count\":" . json_encode($count) . "}";}?>{"data":[{"name":"FaceBook.png","type":"f","size":1331},{"name":"School_dance.jpg","type":"f","size":13576},{"name":"bbb-logo.jpg_600.jpg","type":"f","size":38843},{"name":"bbb_96.gif","type":"f","size":1320},{"name":"blogger_logo.jpg","type":"f","size":18175},{"name":"fztp020w_1.jpg","type":"f","size":46205},{"name":"live_sound_mo.jpg","type":"f","size":22116},{"name":"live_sound_system_rental_mo.jpg","type":"f","size":10794},{"name":"search-engine-optimization_102.png","type":"f","size":18850},{"name":"sound-main-mid-mo.jpg","type":"f","size":29101},{"name":"sound_man_1.jpg","type":"f","size":11412}], "count":11}<textarea id="editor1" id="page_body" name="page_body" style="width: 100%; height: 300px;"><? echo $page_body;?></textarea><script> $(document).ready(function() { $("#editor1").kendoEditor({ encoded: false, imageBrowser: { transport: { read: "/includes/kendoui/service/imagebrowser/read.php", destroy: { url: "/includes/kendoui/service/imagebrowser/destroy.php", type: "POST" }, create: { url: "/includes/kendoui/service/imagebrowser/createDirectory.php", type: "POST" }, imageUrl: "/Company_Images/{0}" }, path: "Company_Images/" } }); });</script>@Html.Kendo().TreeView() .Name("treeview") .DragAndDrop(true) .DataTextField("Name") .Events(events => events .DragEnd("Change") .Select("Selected") .Expand("OnExpand") ) .DataSource(dataSource => dataSource .Read(read => read .Action("GetTreeViewData", "Home")) );
public JsonResult GetTreeViewData(int? id, string Type) /* how can I get my type property here? */ { //data is returned from db - excluded for brevity return Json(data, JsonRequestBehavior.AllowGet); }
treeview.dataItem(e.node).Type (with Type being a property in my Json for the Node)
<div id="grid"></div>$(document).ready(function () { var crudServiceBaseUrl = "http://localhost:11028/IntexService.svc/Zonas", crudServiceOptions = "", dataSource = new kendo.data.DataSource({ type: "odata", transport: { read: { url: crudServiceBaseUrl + crudServiceOptions, dataType: "json" }, update: { url: function (data) { return crudServiceBaseUrl + "(" + data.ZonaId + "L)"; } }, create: { url: crudServiceBaseUrl }, destroy: { url: function (data) { return crudServiceBaseUrl + "(" + data.ZonaId + "L)"; } } }, batch: false, pageSize: 10, serverPaging: true, serverFiltering: true, schema: { model: { id: "ZonaId", fields: { ZonaId: { editable: false, nullable: true }, Nombre: { validation: { required: true} } } }, errors: "Errors" }, error: function (e) { alert("La operación ha fallado: \n" + e.errorThrown + ": " + e.xhr.responseText); this.cancelChanges(); } }); $("#grid").kendoGrid({ dataSource: dataSource, filterable: true, pageable: true, height: 410, toolbar: ["create"], columns: [ { field: "Nombre", width: "150px" }, { command: ["edit", "destroy"], title: " ", width: "110px"}], editable: "popup" }); });