viewmodel

recyclerview not showing data?

怎甘沉沦 提交于 2019-12-13 11:25:36
问题 I am developing news app I am new to MVVM and I have implemented Kotlin coroutines and Koin with ViewModel hosted RecyclerView in fragment class but data not showing only progress bar loading below my screenshot I have posted my code to gist my code on gist below my code where I have implemented recyclerview and viewmodel logic class TopHeadlinesFragment : Fragment() { private val viewModel: MainViewModel by viewModel() private lateinit var topHeadlinesAdapter: TopHeadlinesAdapter //3

AngularJS ViewModel Serialization [closed]

半城伤御伤魂 提交于 2019-12-13 09:18:25
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . How to serialize the ViewModel ($scope) in AngularJS? I'm planning to store the serialized value to a ASP.NET server-side div to persists across postbacks. 回答1: $scope is an object created by AngularJS to interact with the markup. It can contain methods that can be referenced from html. You can create a simple

POST action passing null ViewModel

情到浓时终转凉″ 提交于 2019-12-13 09:13:11
问题 I know this question has been asked and answered a dozen of times but none of the solutions help me. I have a following ViewModel which is consisted of ProductDetail data model and a list of Product_ProductCategoryAttribute data model. public class ProductDetailViewModel { public ProductDetail ProductDetail { get; set; } public List<Product_ProductCategoryAttribute> Product_ProductCategoryAttribute { get; set; } } On an action postback I receive an empty ViewModel. [HttpPost]

Updating a collection of classes or viewmodel

妖精的绣舞 提交于 2019-12-13 08:53:38
问题 I have a viewModel that contains two classes... public class vwbooking { public booking bookings { get; set; } public IEnumerable<trace> traces { get; set; } } Booking and trace are entities in an edmx. I want to update the data in these two class with one call to save. This is what I've tried, along with several other unsuccessful "shot-in-the-dark" variants... public ActionResult Edit(vwbooking vwbooking) { if (ModelState.IsValid) { DbEntityEntry<vwbooking> entry = db.Entry(vwbooking);

Return a viewmodel with IEnumerable's to view and use razor to loop variables into the same row

大兔子大兔子 提交于 2019-12-13 07:28:37
问题 In a razor view, how can I loop through different IEnumerables in a ViewModel and display their variables as columns in the same row? I Return an instance of a viewmodel which is populated with IEnumerables of different models to a mvc view like so: Viewmodel: namespace example.ViewModels { public class ClaimModel { public IEnumerable<Claim> Claims { get; set; } public IEnumerable<Member> Members { get; set; } public IEnumerable<ID> IDs { get; set; } } } My controller which return the view

Update ViewModel from View

核能气质少年 提交于 2019-12-13 06:25:55
问题 Is there any event or way to know the trigger when the ViewModel is updating/updated by the View? INotifyPropertyChanged and PropertyChanged is used when the ViewModel updated the View. But is there any reverse? 回答1: Changes from the view to the view model will trigger PropertyChanged as well, as they set properties. 回答2: If your are binding the controls in your view to the view model, many of the pieces will update the view model as long as you make sure the binding is Mode=TwoWay . http:/

MVC passing IEnumerable<CustomVM> to Controller

跟風遠走 提交于 2019-12-13 06:24:32
问题 Can someone help me to solve this problem. I want to pass ienumerable or just simple list of my custom viewmodel to controller. Theres my code: @model IEnumerable<WebWareApp.ViewModels.OstukorvVM> @{ ViewBag.Title = "Ostukorv"; } <h2>Hetkel ostukorvis olevad tooted:</h2> @using (Html.BeginForm("Create", "ToodeTellimuses")) { @Html.AntiForgeryToken() <table> <tr> <th>Tootenimi</th> <th>Tootegrupp</th> <th>Tootja</th> <th>Mõõdud</th> <th>Varvus</th> <th>Hind</th> <th>Vali Kogus</th> <th></th> <

MVC Passing Four Pieces of Data to the Controller and subsequently to the View

风格不统一 提交于 2019-12-13 04:29:37
问题 This question is part B of my other question here: Inefficient MVC ViewModel Making Multiple Calls to the Database? I knew multiple calls to the db was a bad idea. But, I guess my real question is if I use my last chunk of code or speti43's example let's say like this in my model constructor to eliminate multiple db calls: Public Class OrdersSummary{ ... Public ???? GetOrders(){ var ordersInMemory = orders.ToList(); decimal? GrossProfitTotal = ordersInMemory.Sum(s => s.Profit); decimal?

Binding property with parent ViewModel

白昼怎懂夜的黑 提交于 2019-12-13 03:51:08
问题 Please refer to How can I tell my DataTemplate to bind to a property in the PARENT ViewModel? I have similar problem... But this solution didn't work for me. I have a MainViewModel which has an observable collection of another view model say View1/ViewModel1. This view has a tree control and I need context menu for the tree. My main view has a menu. Those main menu and context menu are connected. So how can I bind the context menu commands to the main viewmodel's properties? 回答1: Basically,

Accessing graph-scoped ViewModel of child NavHostFragment using by navGraphViewModels

南笙酒味 提交于 2019-12-13 03:35:08
问题 I am using the Navigation Component of Android Jetpack (2.2.0-alpha01). I wish to use a child NavHostFragment nested inside my main NavHostFragment, equipped with its own child nav graph. Please view the following image for context: The child nav host is defined like this inside the fragment that is at the front of the MainNavHost's stack: <fragment android:id="@+id/childNavHostFragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="match_parent" android