jQWidgets Forums
Forum Replies Created
-
Author
-
December 29, 2016 at 7:11 pm in reply to: Binding jqTree to viewModel Binding jqTree to viewModel #90194
Dear Peter,
I am struggling now for hours but still no joy.
Just some questions:
1. is it necessaire to use the jqxDatadapter? I just want to display the items. not add or edit them.
2. I did try to translate the modeldata to Json in my view this way:
<script>
$(document).ready(function () {
$(“#dropDownButton”).jqxDropDownButton({ width: 150, height: 25 });
// create jqxTree
$(‘#jqxTree’).jqxTree({ height: ‘400px’, hasThreeStates: true, checkboxes: true, width: ‘330px’ });
var tsource=@Html.Raw(Json.Encode(Model.TreeNodeList));
$(‘#jqxTree’).jqxTree({source: tsource});
})
</script>
Why this is not working?
3. I did try to make a separate Json call as described in https://msdn.microsoft.com/en-us/library/system.web.mvc.jsonresult(v=vs.118).aspx
I added an actionresult in my controller that’s returning: Json(DepartementList, JsonRequestBehavior.AllowGet);
Then in my view:
<script>
$(document).ready(function () {
$(“#dropDownButton”).jqxDropDownButton({ width: 150, height: 25 });
// create jqxTree
$(‘#jqxTree’).jqxTree({ height: ‘400px’, hasThreeStates: true, checkboxes: true, width: ‘330px’ });
var actionUrl = @Url.Action(“DepartementTree”, “JQWidgetsController”);
$.getJSON(actionUrl,displayData);
})function displayData(responce){
$(‘#jqxTree’).jqxTree({source: responce});
}
</script>
But I don’t get beyond the getJson action call.
4. Is there not somewhere a complete MVC 5 example of a controller and a view with a jqxTree?? I am not the first one to using this..thanks for helping.
Rob
Thanks Peter,
When you include existing items in jour mvc project and select a whole directory the sub directories are not copied. that was the whole problem.
Regards
Rob
-
AuthorPosts