Wanting to display a method return using HTML 5 data attribute - html

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)"

Related

Hide JsonValue from log file using <flter-spec>

I'am trying to hide the Json value of the student field from log files using filter-spec,
this is my filter-spec :
after i applied the flter this is how the data is showing in the log file
all i want it is to replace ("student" : "testStudent") with ("student": "****") instead it is got replaced with ("student: ****)
does anyone have an example on how to hide the json value using filter-spec?
Thanks in advance
It is not actually possible replace a JSON value with a filter. You'd need to use a custom filter or custom handler in order to do this.
You could file a feature request though. It does seem like a decent idea for a filter to be able to filter values in structured formats.

How do I retrieve all column fields as objects from Tabulator?

I want to make the custom filter dynamic. So, for writing future code I could pass in a list of references to each field object in the table.
That way I do not have to hardcode data.(field name here). Instead, it would work off the list of properties of the column object.
I know there ways to get the field normally but they are always returned as strings not object references. This obviously will not work with the dot operator.
I have some success with using JSON.parse followed by looping through the entries. But like before it returns the field as a string instead of a reference.
So is there a way to retrieve the column fields as objects and if so how?
I tried using the getColumns but I am still getting undefined when grabbing the fields. There is something wrong with my code.
function customFilter(data, filterParams) {
//data - the data for the row being filtered
//filterParams - params object passed to the filter
for (column of table.getColumns()){
field = column.getField();
console.log(data.field);
}
}
You speak about references in your question, but references to what? the field names themselves arent references to anything, they simply show Tabulator how to access the underlying row data, without a specific row data object to reference, there isn't anything to build any references from
You can only have a reference if it points to something, but there is nothing for the field definitions to point to without the row data.
If you are looking to have objects that you can manipulate the the getColumns function returns an array of Column Components with each component having a range of functions that can be called to manipulate that column. including the getField function that returns the field for that column.
Given that the Tabulator filter functions will accept the filed names with dot notation that shouldnt be an issue at all, but you can also pass the column component directly into the filter, so it shouldnt be a problem their either

Getting the value of a particular cell with AJAX

My goal is very simple and I would guess it is a very common goal among web developers.
I am creating a Rails (5.1) application, and I simply want to use AJAX to get the value of a specific cell in a specific row of a specific table in my database (later I am going to use that value to highlight some text on the current page in the user's browser).
I have not been able to find any documentation online explaining how to do this. As I said, it seems like a basic task to ask of jquery and ajax, so I'm confused as to why I'm having so much trouble figuring it out.
For concreteness, say I have a table called 'animals', and I want to get the value of the column 'species' for the animal with 'id' = 99.
How can I construct an AJAX call to query the database for the value of 'species' for the 'animal' with 'id' = 99 .
Though some DBs provide a REST API, what we commonly do is define a route in the app to pull and return data from the DB.
So:
Add a route
Add a controller/action for that route
In that action, fetch the data from the DB and render it in your preferred format
On the client-side, make the AJAX call to that controller/action and do something with the response.

ColdFusion convert hidden form variables to a structure

The app I am working on has hidden input variables set on initial load of the page. The variables need to be accessed across all pages. The reason for not converting these to session variables is the user can open another browser with different parameters and passing those value as hidden inputs make it work without any issue. What is the best possible alternative so as to get rid of these hidden inputs..I tried converting all variables into a Structure, but again the structure needs to be posted as part of form submission to make it available to subsequent pages.Another disadvantage of this app is use of frames.I don't have any code to post.
It sounds as if you want different browsers instances which are associated with the same web session to maintain their own distinct sets of data. Doing this by passing form or url variables around seems like a bad idea.
One approach that you could use would be, onSessionStart (or as required), create a structure in the users session to hold instances of the data. For example
session.data = {
someRandomKey: {
valueA: 42,
valueB: "Porridge"
}
}
Then just pass someRandomKey as a hidden form field or querystring parameter. Now, when they submit the form to update variables you use the id from the hidden form field to find the appropriate structure from session.data.
When the user needs a new instance of this form, give them some way, like a link or button, that creates a new unique key, inserts a struct in session.data with this key and populates it with whatever defaults are needed then loads the form passing along the new id as a hidden form field or querystring param again.

In Talend, how do you keep input values provided to tSoap so that you can use them with the Soap response?

I have a Talend Job that currently does the following:
Input CSV --Main--> tMap --Output--> tSoap --Main--> Output CSV
The input CSV has
ID and TYPE as input columns.
The Map creates a Soap XML (String) message using the ID from the CSV and passes that String to the tSoap component.
The tSoap component fires the web request, which sends the response to the next component. That data is then written to CSV.
The problem is that TYPE from the input CSV is not passed through to amalgamate with the SOAP response data. Only the response data seems accessible.
I've had a look at tBufferInput / tBufferOutput and tFlowToIterate but they seem to work in scenarios where the tSoap component does not depend on an input from the main flow.
Does anyone know which components can be used to achieve the amalgamation?
Thank you
If you output the data you need to reuse to a tHashOutput component you should be able to rejoin your data with the response output from tSoap assuming there's some natural join element from the response.
I solved this in the end by:
Placing between the output from the tMap and the input to the tSoap, a new component - tSetGlobalVar
Inside tSetGlobalVar, you can then create a new row, which maps an input column (Value) to a named variable that you specify as the 'Key'.
E.g. Key = "ID", Value = row11.ID
The output from tSetGlobalVar then goes into the tSoap component.
The output from tSoap goes into a new tMap.
Inside this new tMap is the Body column from the previous tSoap component which maps to an output column. To access the stored "ID" variable for the current flow/iteration, I created a new output column, and instead of mapping any columns from the inputs, used (String)globalMap.get("ID"); which would insert the value back into the flow.