How to synchronize view component data with a partial view? - asp.net-core-mvc

I want to display my .NET Core web page as per the below image.
For the left pane, I am using a partial view whereas I'm rendering the right pane with view components.
I call different API's to retrieve data from the database in order to display data in both panes.
I want to synchronize the left pane record count with right pane view component data.
Is their any pattern/combination of view components or partial views to achieve my requirements?

I want to synchronize left pane record count with right pane view components data. Is their any pattern/combination of view-components or partial views to synchronize my requirement.
You can put rows of each view component into specific "container" with specific css class, such as "vc1-row", "vc2-row" etc.
On client side, you can traverse rows of view component(s) and calculate count of rows of each view component after DOM is ready, and update/repopulate left panel record count via JavaScript/jQuery code.
Besides, if you'd like to implement something like portal/dashboard, which could retrieve data from back-end service and push real-time data to clients and update clients UI with new data, you can try to use SignalR.

Related

Recommendations for developing Laravel User account pages as SPA?

Looking to rebuild account pages for users of a Laravel 8 based application using something like Inertia/Livewire, Vue/React to make just the account area an SPA. User accounts currently have many pages in which to manage their items and have a dashboard that summarises item data that link to item listing pages for managing.
Ideally the new dashboard will have component based widgets which would load the HTML with temporary place holders for the items whilst the data is being requested. Not sure what would make a better user experience, having the whole page show temporary place holders for dynamic data and then all populate at the same time or populate each component as and when the data is ready.
Would it be more efficient to have each component request its own data individually or should each component specify what data it needs to the parent component (dashboard) which then does one request for all widgets?
The widgets would link to item listing pages where users can manage items. The way the listing pages should work is very similar to that of Asana, when an item is selected it opens a panel to the right of the list which loads the data related to that item. Again, when the panel opens it has place holders until the data requested has been fetched.
With Inertia the data can be queried in the controller and then passed as props to the view that Inertia renders. Items would be passed in this way and then listed on a listing page component. The URL should update from /items to /item/123 when clicking an item so it would have its own dynamic route that passes the item id to the relevant action.
Would this have its own action separate from the one that gets the initial list of items?
The list still needs to be there and used to click between items so was thinking it could actually use the same action?
Items could be in the thousands and will have filtering options so pagination and throttling will be necessary.
Been looking at Inertia with Vue so far and it looks to meet requirements, can’t change from using Laravel 8, just wondering what approach would be most suitable or if there is another approach that should be considered. Interested to hear how others might go about it.

How to cross update of view between nattable and Jface view

Eclipse RCP View Communication ,where one view contains nattable and another views contains jface controls like button, dropdown.
Currently for example there is 3 view/Editor as shown below
View1 - contains employee details which is a Nattable and
it's cell contains data like String, Long, boolean, date value.
each row represent one data,and other views are corresponding data of
selected row
View2 - shows Address which is corresponding to the selected row in the View 1,
User can modify data of view2.
View3 - shows department details of employe, which can also be modified
So all 3 views present data of one model say Employee
Employee
|_Name
|_EmpId
|_Married
|_DOJ
|_Address
|_Type
|_City Name
|_State
|_PinCode
|_Department Details
|_Department
|_Project
|_Manager
Problem:
I want to know what is best way of communcation between views1 and other view such that
On selection of row in view1 then other two view should be update correspondingly;
If any data changes in view2/view3 then view 1 should get notification for data change in other view
when condition 2 occurs then I want to show dirty row in view1.
The typical approach for inter view communication in an E4 application related to your described scenario is to use the ESelectionService to trigger handling of a selection for opening another view, and to communicate back via the Eclipse 4 event system.
For scenario one to open a view based on the selection in a NatTable you could use the E4SelectionListener in the NatTable Eclipse 4 Extension Feature. It is a ILayerListener that forwards the selection to the ESelectionService. An example can be found in the NatTable examples.
To inform view 1 about changes in another view, I would suggest to use the IEventBroker to send an event from view2/view3 and react on the event in view1. This way the views are decoupled as much as possible. Eclipse 4 event system is a good starting point for learning about the event system.

Where to store the state in MVC model

I'm writing an infinite scrolling list. There is a data grid that displays the data and a controller and model that provides the data to this grid.
Right now, the view receives the list of data and displays it. For the sake of infinite scrolling, it throws an event which lets its parent know that it needs the next page of data. The parent requests the next page of data, and it's the controller that decides what is the next page of data (in terms of page number, page size, etc.)
I'd like to know where I should keep the page number and page size, or in general, using MVC, where are we supposed to keep the state ?

Update a Struts tiles with Ajax

i have a question for you with no code :)
I have a Struts2 Web Application composed by several tiles. The main tile called content, show the interface for the business use case currently in use.
In one case, I have a content tile composed by only some Jquery accordion and one button "Add". On the action linked to the tiles, I have a collection of oblects. When the tile is open by the user, i loop trouhg the collection to create on accordion 8the relation is 1 to 1).
The Add button add an entry into my collection. After the add, I am aspecting to see another accordion on the page.
Is there a way to refresh the tiles withpout he entire page??
Yes one way is have an action return json, the struts2-json-plugin makes this very easy.
See: https://cwiki.apache.org/confluence/display/WW/JSON%20Plugin
Handling the json on the client side then becomes a JS/JS library question.

Communication between components (software design question)

I have an application with the following UI components:
Main Menu
Folders Tree
Query Builder
Tabbed Lists (each tab has a grid that can display data entities)
The application is based on MVC, so each component listed above has a controller and a view.
The first three components need to display data entities on the list (as new tabs):
Double clicking on a folder will display the folder's items in a new list.
When clicking the search button in the query builder it will open the search results in a new tab.
When clicking "Open..." menu item it and selecting a file it will open a new tab with the items in the file.
Since there could be a lot of items the process of loading them from the database is done asynchronously by the grid (the grid is being filled as you are looking at it).
My question is this: which of the following is a "cleaner" design? (if you have better solutions, I will appreciate it very much)
The first solution I have is to use an EventAggregator, define a "ShowQuery" event, make the lists controller subscribe to it, and the other controllers will publish it when they want to display the query results.
The other solution is something like the Unity Container, and from the other controllers resolve the "IListsController" interface, and call the "ShowQuery" method.

Resources