Anyone know why when I remove an item from my datasource it removes it from my database, but not my Mobile List View? Below is basically what I'm doing:
model = dataSource.getByUid($(e.touch.target).attr("data-uid"));
dataSource.remove(model);
dataSource.sync();
I got this from the mobilelistview sample app and it works correctly, just not with my modified mobile list view. Could it be because of a filter I have or my type of model or something? Here is the Mobile list view control section:
Html.Kendo().MobileListView<eAgentWeb.Models.CallLogModel>()
.Name("MainListView")
.TemplateId("itemTemplate")
.PullToRefresh(true)
.EndlessScroll(true)
.DataSource(dataSource => dataSource
.Sort(sort => sort.Add("DateModified").Descending())
.Filter(filters => { filters.Add(calllog => calllog.IsArchive).IsEqualTo(false); })
.Read(read => read.Action("GetCallLogData", "CallLog"))
.Destroy("callLog_Destroy", "CallLog")
.PageSize(30)
.Events(events => events.RequestEnd("listViewRequestEnd"))
.Model(model => model.Id(c => c.CallLogID))
)
)
)
Any help would be greatly appreciated!
Hi,
I'm trying to use a MobileListView in my project with this code:
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12"
>
@(Html.Kendo().MobileView()
.Title("Chiamate")
.Header(obj =>
Html.Kendo().MobileNavBar()
.Name("ChiamateNavbar")
.Content(navbar =>
@<
text
>
@navbar.ViewTitle("Chiamate")
</
text
>)
)
.Content(
@<
text
>
@(Html.Kendo().MobileListView<
Telesan.CloudLift.WebApplication.Models.Chiamate.ChiamataListViewModel
>()
.Name("ChiamateListView")
.TemplateId("ChiamateTemplate")
.PullToRefresh(true)
.EndlessScroll(true)
.DataSource(dataSource =>
dataSource
.Read(r => r.Action("ChiamateAjaxList", "Chiamate").Data("onData").Type(HttpVerbs.Post))
.ServerOperation(true)
.Filter(t =>
{
t.Add(m => m.DataOra).IsGreaterThanOrEqualTo(DateTime.Today.AddDays(-3));
t.Add(m => m.IDStato).IsNotEqualTo((Guid)ViewBag.StatoChiuso).And().IsNotEqualTo((Guid)ViewBag.StatoElaborato);
})
.Sort(s => s.Add(m => m.DataOra).Descending())
.PageSize(50)
)
)
</
text
>)
)
</
div
>
</
div
>
But it doesn't render to my page so after a search I've found a possible solution by adding this in _L:
@(Html.Kendo().MobileApplication()
.ServerNavigation(true)
)
Your kendo mobile application element does not contain any direct child elements with data-role="view" attribute set. Make sure that you instantiate the mobile application using the correct container.
This is the _Layout block where @RenderBody is:
<
div
class
=
"cloudlift-container"
>
<
div
class
=
"row"
>
<
div
class
=
"col-xs-12 main-content"
>
@RenderBody()
</
div
>
</
div
>
</
div
>
@(Html.Kendo().MobileApplication()
.ServerNavigation(true)
)
Can somebody help?