innerHTML doesn't work properly in dynamically taken HTML from another element - innerhtml

There is a table that js creates dynamically.
A button triggers a function that get the tables first rows innerHTML.
And replace its with
While raplacing it takes style informations as is to the divs.
After these i add some extra styling to div with replace() too.
But that function creates and fills with . Is it about percentage width or another thing?
The sample code is spagettied too much. So i couldn't paste here.
I am using HTA (HTML Application) and vbs+javascript.
Thank you in advance
Çağlar

Related

primeng editor source code not working in angular 5

When tried to edit source code in primeng tag, It is only editing one line at a time and without an html showing html tag also.
For example if I write "Text is bold", and when I clicked it on p-editor's ql-code-block
The expected values are to be shown in textarea is < p>< strong>Text is bold< /strong>< /p>.
Actual value shown in textarea is as follows:
Before :
Before selection of ql-code block
After :
After selection of ql-code block
Also after unselecting the ql-code-block button it removes the actual bold font of the text as follows :
After unselection of ql-code block
Please help me out in this.
Thank you in advance :)
If I understand correctly what you are saying, the answer is that you can't have bold in a code-block section (ql-bold or ql-code-block, not both).

selenium ide : click button with class on specific row in table

I have an html table wich contain multiple lines.
At the end of each line, the last row contain multiple button. I would like to click on the remove button of the first line.
I tried this Xpath code but the element in not located :
There is a mistake somewhere in my xpath query :
//table[#id='tableTest']/tbody/tr[8]/td[8]/a[#class="remove"]
Your query looks pretty OK, but there is no HTML code so we can just guess what happen. What about the number 8?
Try to use XPath axes. For example locator could look like this:
//table[#id='tableTest']/tbody/tr[1]/descendant::a[#class="remove"]
This should find the remove button in the 1st row whenewer it is.
Click the button of the first line... which I think you mean first row?
//table[#id='tableTest']/tbody/tr//a[#class="remove"]
That SHOULD find the first tr (row) of your table and select the href with the class remove. But it's not going to ensure it's the last cell, which if that's vital you'll need to use something like //table[#id='tableTest']/tbody/tr/td[last()]/a[#class="remove"]
Also, if you attach the html snippet this becomes much easier for many of us to answer.

How to make button as one of the column inside table component in CDE Pentaho?

I am trying to make the table component with the button inside the table column in CDE Pentaho. How can it be achieved?
I guess it will need some work.
In the Draw function of your table, you may put some javascript to manipulate the DOM and add your button : as far as I remember, the draw function receives a parameter that is a structure with the column and row index of the current cell.
Try first this code in the draw function :
function(paramdraw) {
console.log(paramdraw);
}
and look for the content of paramdraw iin the console.
Maybe there is a better way to do it...
What we do here usually is something like editing the query on the datasource with a column that output the HTML code for a button.
SELECT
ID,
NAME,
concat('<input type="button" onclick="alert(',ID,')">click me</input>') as button
FROM
foo
WHERE
bar='bar';
That should display a button. If you are not using a query as datasource, but a transformation the idea is the same. Just make the output contains a string that when interpreted by the browser is a button.
Hope it helps. =)

Is it possible to colour a cell with value from data in Cognos BI?

Let me first be clear. I'm not asking about how I do conditional formatting in Cognos BI. If there were a simple Red/Amber/Green colour scheme, based upon value ranges then I could do that. If it were a static list of colours, which never changed, I could also do that.
What I am after is accessing a hex colour code that is stored in my database, and I want to use that colour as my table cell background colour. This is something I commonly do in SSRS reports, but cannot see a method for in Cognos BI.
Is this even possible?
You can do this via the HTML object in Cognos.
The HTML object can get its definition from one of the three main ways:
1) Hard-coded text
2) Data Item Value
3) Report Expression
Obviously the first method provides no way to dynamically set the value. I couldn't get the second one to work at all. I'm not yet sure why. However, I was able to use the third type to work to allow dynamic setting of a visual style.
For the solution we'll assume you have a data item called [Color] which pulls a string value from a database in the standard hex form that is used in CSS: #xxxxxx, e.g. #CCCCCC. For the purpose of this example we'll assume it is in query Query1. The following steps describe how to set it up.
1) Add an HTML item right above your list
2) Add another HTML item at the bottom of your list
3) In the top HTML item add a span tag with a unique id such as:
<span id="list">
4) In the bottom HTML item add a closing span tag
</span>
5) Add a third HTML item before all of the other HTML items
6) Set the 'Source Type' property of the HTML item to 'Report Expression'
7) In the Report Expression put the following code:
'<style>
#list td {
background-color: ' + [Query1].[Color] + '
}
</style>'
8) Select the Page object and set the Query property to Query1
9) Click on the Properties property. Check the Color column to give the page access to that query-sourced value.
Now you can dynamically set the column color based on a database provided value. We used the span to give us a way to isolate just the table cells we want to manipulate.
The technique isn't perfect. For instance, the header cells also get their background changed to the color in question, which may or may not be desirable. This is because Cognos doesn't use the th tag for headers but instead renders them as normal cells (td).
I know it's quite and old post but just for completeness I'll add the references to get this working in html, pdf and excel.
To get this working not only for html but also for pdf and excel use a rich text item instead of a html item.
You can use following code in a query item for instance:
<span style="display:block; background-color:' + [Query Subject].[Query Item] + '"> </span>
The query item must then contain a valid color (e.g. rgb(255,0,0)) etc. which is defined by your data source.
Dragging a rich text item in a list and changing it to data item value and selecting the query item will work.
By using the span it will work for excel too, however to make sure it follows the size of the upper object in the hierarchy (the list column or a table etc) you want the display:block style.
Instead of the space in between the > < you can use any other query item that you want to appear as text.

BIRT result set values in specific cells

My query returns location_cd(string) and item_count(int). I only need certain rows from the result however and I need them to display in specific places in my layout so I don't think the table solution is going to work. Can I determine where I place the value for a particular row of the result set?
I am using a grid to display values for a number of fields. I cannot seem to be able to get the values from the results to show. The grid is bound to the result set. I even tried binding the cells to the result set but that didn't work either.
I checked in the query editor and there is a result set shown in the Preview so I know the query works. The complete and correct result set shows if I put a table on the page.
I tried inserting a Dynamic Text or Data object in a cell and used the expression:
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:""
This returns a blank and does not seem to evaluate. I tested it with :
dataSetRow["location_cd"]=="3SD"?dataSetRow["item_count"]:"BLANK"
and got 'BLANK' to appear in that cell.
dataSetRow["location_cd"] and dataSetRow["item_count"] will display the location_cd and item_count from the first row of the result set. row.outer[] did the same thing. Obviously I am just hacking at this report at this point.
A co-worker suggested that she uses a JAVA if-statement in places like this but I could not get that to work either.
Any ideas or suggestions that will get me on the right road??
Thanks
An elegant option would be to use a HashMap storing the result of the dataset.
Declare a report variable named "values", with a new hashmap as default value (see image below)
Fill values in the onFetch script of the dataset: vars["values"].put(row["location_cd"],row["item_count"]);
Insert new data elements at any place of the report with expressions such: vars["values"].get("myFavoriteLocationCD");
Though it is important to note the dataset should be triggered by the report before these data elements.
The particular row you want to display you specify in a "Text" field inside your grid. Just drag and drop a "Text" field inside your grid. If you bound the fields you want to display to your grid, the "Text" field inside the grid inherits the bindings of its parent (the grid), so you can access the bindings automatically in the "Text" field.
You could try following steps, maybe that works.
Don't use "Dynamic Text" field, instead use a regular "Text" field
Ensure the fields of your query which you use, are bound to the grid (you sayed you already did)
Open the "Text" field
Change preselected pull-down entry "Auto" into "HTML"
Change preselected pull-down entry "Formatting" into "Dynamic Text"
Wrap your code in <value-of format="HTML"> your code goes here... </value-of>
Note: You should check in the "Expression Builder" of your "Text" field if you are able to access the fields you bound to the grid. If they are not available sth. went wrong with your binding. Avoid binding query records to cells this will drive you crazy.
If you want to display a list, ensure you didn't set a constant height in the row of your grid. Set the height to 100% than the row takes its height dynamically.
What about the idea to optimize your query, that only get the results you want are displayed, than you don’t need to filter them with java script? If you don’t need the filtered results in another place this would be the cleaner solution in my opinion.