Angular Table Sorting - Data shows up but doesn't sort - html

I'm trying to implement sort function to my table in angular, and all my data from my rest api does show up in the table. But the problem I get is when I click on arrow my data in table doesn't sort. My data comes from a method in other ts file witch get the data from rest api
What I have tried is followed this links but it doesn't work
Angular Material Table Sorting - Data Doesn't sort when inside a *ngIf condition
Sorting Not Working Angular Material Design Table
https://material.angular.io/components/table/overview#sorting
I have some problem to upload code
This is my controller code, the method to get code from rest api: https://imgur.com/a/qX2AcNJ
This is my code who should take a data from controller and show in html: https://imgur.com/a/OR0SQvH
This is the html file: https://imgur.com/a/q4FJmuK

Your table is missing the instruction on how sorting must be done. You should add the following to your table element.
<table ... (matSortChange)="sortData($event)">
Then you need to to add the sortData method to your ListComponent. A detailed example can be found at https://material.angular.io/components/sort/examples.

Related

Wanting to display a method return using HTML 5 data attribute

So I have a dynamic table in angular where im passing data in, then creating the table. I want to add some CSS in order to check the values then add some styling onto it. So if the value is a minus number, then display the data in red
I have used attribute data to check the actual data, which works fine until i call to typescript method to generate the data instead of hardcoding the data in, and this is where is goes wrong. So I want to call this method to get the data instead, and it just displays the method name instead of the method return
You can use the attribute binding of data instead of the interpolation if the data returned by the method is not a string - more details here
[attr.data]="getData(header, body)"

Get multiple Drop down menu Data using POST in NodeJS

I have multiple Drop down menus and have a single button that posts all the data, like
.
But I am getting undefined on using req.body.stringdata:
Here are the
and the
How can I receive the data?
To get the data, use req.query['stringdata']) as the method used is GET.

Populate select box based on dropdown list

I am trying to get either a dropdown or selection box(prefer the later, because of the possibility to choose multiple values at once) in a webform.
In this case i already got the dropdown working, based on measures.measurement_type. The second needs to be measures.measurement, filtered by the type selected in the first dropdown.
I can not seem to get this working. I tried googling, but without succes. Can anyone help me get on the right track?
I found solutions using Arrays, but no working solution using 1 database table.
using ruby 4.2
Thanks
There are two options for this.
Using AJAX calls. Like #Ronan said in his answer, you need to make an AJAX call on the selection of first drop down (on change method). In the rails action method, you can render a JS partial where you can set the filtered items for second drop down.
Another one is totally client side. Like render all the possible items of both drop downs to client side. Meaning both type and measurements as javascript array. Then when changing the type drop down, filter the measurements array using jQuery and populate in the second drop down.
You gotta use some ajax for doing that, can't see other way. When your measures.measurement_type changes, you send a request passing that measurement_type as param for your action. In that action, you retrieve the collection of measurements based on the measurement_type passed in the param, and then return that data to be handled on your success ajax callback. On that method, with some jquery you should populate the second input with the options returned.
This is some simpler explanation... you should take some look at a more complete article for understanding step-by-step. Would suggest this one, for example: https://remysharp.com/2007/01/20/auto-populating-select-boxes-using-jquery-ajax. Good luck!

How to get html dynamic table data in response of jmeter

I am using the JMeter for the testing the application.
In the same, I have visited some page where the dynamic table contents should be displayed on the response data in view results.
However except that HTML dynamic table I am able to view the other contents so please help for getting the contents of the dynamic table too.
I have tried to get it using regular expression also have tried to get it with XPath extract. It goes till the <thead> tag, however, doesn't view the values in the <tbody>.
Here I have wanted to get the trains details. As the table is dynamic we should be able to get the values in the response of jmeter. However I am not able to get this contents.
In the same i tried to get the values of the special trains page using XPath so it gives me error of Illegal expression.
Screenshot no.3
I have not used any different library to get the html table data values.
I have tried to get the table contents by using the table it in regular expression
Xpath Query: "/html/body/table/tbody/tr2/td/div"
Reference name: Special_trains
so it gives the output java.net.URISyntaxException: Illegal character in query at index 77: http://enquiry.indianrail.gov.in/ntes/specialTrains.jsp?scrollerDivSpltrn=Not found
In the same the div id is: "scrollerDivSpltrn"
Hence need the answer
You just need to extract the table id properly. Once you are able to extract the that id, you should be able to fetch dynamic table.

Make grails pagination

My controller returns results in a Array like this:
render (template: 'show' , model: [changes: changes])
Show is a default action and changes is an Array created with a query(createCriteria).
How can I make pagination in my index.gsp page which is displaying results in a HTMl div?
My problem:
Controller:
def list() {
[terminHistorie: changes, terminHistorieCount: changes.size()]
}
gsp:
<g:paginate controller="terminHistorie" action="list" total="${terminHistorieCount}"/>
Error: Tag [paginate] is missing required attribute [total] at C:/Users/matejb/Documents/NetBeansProjects/gutmann/grails-app/views/terminHistorie/index.gsp:309
The way pagination works is you first need to create a view using paginate tag, then on your show action you need to slice your changes. Meaning that the view will send the offset and max parameter and your createCriteria will query the database only for those data. Take a look at this page and then here to see how you can pass max and offset into your createCriteria method.
To see an example, see this page or create a new application with one simple domain and generate scaffolding for it. Grails will generate a paginated result for you.
Btw, if you are using ajax you might want to use remote paginate plugin.