|
To highlight a row of what? What I mean by this is that it depends on how you setup the HTML. If you setup HTML that can be modified in a 1 liner in JavaScript and CSS, then my example would work easy. It really depends on how you designed the HTML.
I would imagine that you just create a class in CSS to create the visual effect you need, then add that class to each element that needs to be highlighted.
These elements could have a master element wrapper, in which you would add a new CSS visual effect, that would highlight all the child elements.
<div class="wrapper">
<div class="element">1</div>
<div class="element">2</div>
</div>
Something like this would add the class. Not tested, just off the top of my head
if (field.entered == 1 && field.pcnt_staged != '100%') {
let wrapper = document.getElementByClassName('wrapper');
if (wrapper) {
wrapper.classList.add('red-all');
}
}
<div class="wrapper red-all">
<div class="element">1</div>
<div class="element">2</div>
</div>
In css I think it would be, master element select all child divs within the master.
.red-all > .element {
color: red;
}
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
thanks for the input.
we are building in a html table and display the results.
var fldText = "There are 10-15 fields in the tables.
So need to highlight all these 15 fields conditionally.
|
|
|
|
|
|
Hello,
I'm looking into taking a course and on the precourse material the question ask...
function NumberFour(value){
let greaterThanFive = false;
// In this exercise, you will be given a variable, it will be called: value
// You will also be given a variable named: greaterThanFive
// Using an 'if' statement check to see if the value is greater than 5. If it is, re-assign greaterThanFive the boolean true.
// Please write your answer in the line above.
return greaterThanFive;
}
How would I know if the value is greater than 5? Is this a trick question... would someone please explain.
Thanks
|
|
|
|
|
Quote: How would I know if the value is greater than 5? Really?
That is the purpose of the course, and the author would have explained the operators and language structure to perform this operation. I recommend taking the course, and also exploring JavaScript language, you can start at MDN; JavaScript | MDN.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I am working on a cep html panels extension and I am facing this known "thorn" of asynchronous code!!! I know that the most secure way is to use promises and async/await, but my problem is that I can't really understand how I can suit my code to promises and async/await. I believe an example based on my code would really help me.
Here is a small example of my code...
JS FILE CODE:
(function()
{
'use strict';
const csInterface = new CSInterface();
const extensionId = csInterface.getExtensionID();
let psDocumentsLength;
function init()
{
themeManager.init();
$(document).ready(function()
{
setTimeout(function(){check_PSDocumentsLength();
setTimeout(function(){reclaim_PSDocumentsLength();
}, 100);
}, 100);
});
};
function check_PSDocumentsLength()
{
var chosenFunction = 'checkDocumentsLength()';
csInterface.evalScript(chosenFunction, function(result)
{
psDocumentsLength = result;
});
};
function reclaim_PSDocumentsLength()
{
if(psDocumentsLength < 1)
{
alert('There is no opened document!!!');
csInterface.closeExtension()
};
};
init();
}()); JSX CODE:
function checkDocumentsLength()
{
return documents.length;
};
As you can see, in order to avoid the phenomenon of asynchronous code, I am using nested setTimeout(s). Is there anyone who can explain to me how I can do the same thing but using promises and async/await?
Thank you in advance!!!
|
|
|
|
|
Promises really are not that hard. They basically allow you to dynamically attach callbacks to an object, which are execute when you designate within the promise function.
In your case it would look something like this:
function init()
{
themeManager.init();
$(document).ready(function()
{
var promise = new Promise((resolve, reject) => {
try {
var chosenFunction = 'checkDocumentsLength()';
csInterface.evalScript(chosenFunction, function(result)
{
resolve(result < 1);
});
} catch(ex) {
reject(ex);
} finally {
csInterface.closeExtension();
}
}
promise.then(function(value){
if(!value){
alert('There is no opened document!!!');
}
});
promise.catch(function(error){
console.error('checkPSDocument error: ' + error);
});
});
}
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Try something like this:
(async function(){
'use strict';
const csInterface = new CSInterface();
const extensionId = csInterface.getExtensionID();
const runEvalScript = (script) => new Promise(resolve => csInterface.evalScript(script, resolve));
const waitForDom = () => new Promise($);
themeManager.init();
await waitForDom();
var psDocumentsLength = await runEvalScript('checkDocumentsLength()');
if (psDocumentsLength < 1) {
alert('There is no opened document!!!');
csInterface.closeExtension();
}
})(); NB: async functions[^] are not supported in Internet Explorer. Neither are arrow functions[^] or promises[^].
let and const [^] are supported in IE11.
If you need to support IE at all, you'll need to use a "transpiler" to convert your code to ES5.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Dear All,
How do i get the client's windows login name in java based web application.
|
|
|
|
|
There may be some hacks out there, but unless you're on a domain, that should not be possible and would be considered a security risc.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Have your Java-based web app send a current user object to the client, where it can be interpreted by your JS...?
Not 100% sure what you are asking here.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Hi,
I have an intranet application in which i should be able to get the client machines windows user login. usually our staff login by their employee Id, if i could be able to get the login id based on that i will display the menu list(access control). this functionality i am trying to avoid login phase for intranet application.
|
|
|
|
|
If you're in an Active Directory environment and your users are on Windows computers, you can use Windows Authentication in IIS in order to automatically use their currently logged in claims principal. I don't know the interface for Java, but I'm sure there is one, and it's trivial using asp.net.
"Never attribute to malice that which can be explained by stupidity."
- Hanlon's Razor
|
|
|
|
|
Dear
Nathan Minier ,
Thank you so much.
|
|
|
|
|
// ------- Please begin your work below this line: -------
function exerciseOne(){
// In this exercise, write a simple 'for loop' that starts the variable 'i' at 0 and
// increases i until it reaches 6.
// Fill in the blanks in the parentheses, and then console.log(i) inside of the for loop
(;;)
for(let i=0; i < 7; i++){
console.log("This is i:",i);
}
console.log(str);
// Please write your answer in the line above.
}
}
function exerciseTwo(){
let count = 0;
// In this exercise write your own for loop (you can look at the syntax above).
// It should loop 10 times.
// You are given a variable called: count .
// For each loop reassign count to the current value of count + 1 .
for (var i = 0; i < 10; i++) {
count ++;
}
//Please write your answer in the line above.
return count;
}
//Assignment 13 exercise 1 is showing correct but 2 is undefined
function ClassOne(name, pw, mail){
// Exercise One: In this exercise you will be creating your own class!
// You are currently in the class, you are given three strings, name, pw, and mail.
// You need to create three properties on this class.
// Those properties are: 'username', 'password', and 'email'
// Set the value of username to name,
// Set the value of password to pw,
// Set the value of email to mail
this.username = name;
this.password = pw;
this.email = mail;
}
// Note: Remember you DO NOT need to return anything in a class!
function ClassTwo(name, pw, mail){
// Exercise Two: Now that you have created your own class,
// you will create a class with a method on it.
// In this class create 4 properties: username, password, email, and checkPassword.
// Set the value of username to name,
// Set the value of password to pw,
// Set the value of email to mail
// Set the value of checkPassword to a function.
// The checkPassword function takes a string as it's only argument.
// Using the 'this' keyword check to see if the password on the class is the same as
// the string being passed in as the parameter. Return true or false.
this.username = name;
this.password = pw;
this.email = mail;
this.checkPassword = function(){}
if (this.checkPassword === pw){
return true;
}
}
|
|
|
|
|
function exerciseOne(){
(;;)
for(let i=0; i < 7; i++){
console.log("This is i:",i);
}
console.log(str);
}
}
|
|
|
|
|
I am trying to write a javascript helper function in my Ember application called compare.js, and that js file is trying to import Ember, where its throwing error, can anybody please suggest me something how to get-rid of this type errors? Here is my compare.js files code - thank you.
import Ember from 'ember';
export function compare(params) {
if (params[3]) {
params[0] = params[0].toLowerCase();
params[2] = params[2].toLowerCase();
}
let v1 = params[0];
let operator = params[1];
let v2 = params[2];
switch (operator) {
case '==':
return (v1 == v2);
case '!=':
return (v1 != v2);
case '===':
return (v1 === v2);
case '<':
return (v1 < v2);
case '<=':
return (v1 <= v2);
case '>':
return (v1 > v2);
case '>=':
return (v1 >= v2);
case '&&':
return !!(v1 && v2);
case '||':
return !!(v1 || v2);
default:
return false;
}
}
export default Ember.Helper.helper(compare);
I want to be able to import or use this function in my hbs file, how can I do it any help please to fix these two things please - need some help - thank you.
|
|
|
|
|
simpledeveloper wrote: import Ember from 'ember';
I would imagine your issue is here.
It is case sensitive, or perhaps the location is wrong, or it's not registered.
Check the file, and work back to the source of 'ember'
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Yes it was case related, I figured that out, but now it says my function is not a helper function any help buddy?
My helper function is as below:
export default () => {
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
alert("hi");
if (params[3]) {
params[0] = params[0].toLowerCase();
params[2] = params[2].toLowerCase();
}
let v1 = params[0];
let operator = params[1];
let v2 = params[2];
switch (operator) {
case '==':
return (v1 == v2);
case '!=':
return (v1 != v2);
case '===':
return (v1 === v2);
case '<':
return (v1 < v2);
case '<=':
return (v1 <= v2);
case '>':
return (v1 > v2);
case '>=':
return (v1 >= v2);
case '&&':
return !!(v1 && v2);
case '||':
return !!(v1 || v2);
default:
return false;
}
});
}
And I am trying to use it as below:
{{#each novi.violations as |noviv index|}}
{{#if (ifCond novv.ViolationId '==' noviv.ViolationId true)}}
{{log 'someVariable'}}
<br />
{{/if}}
{{/each}}
Here is the error that I am getting
sayingember.debug.js:43618 Uncaught (in promise) Error: Compile Error: ifCond is not a helper
Any help buddy?
modified 5-Nov-19 21:27pm.
|
|
|
|
|
Hi, I have an ember hbs component, in which we have table, in which the value of a td should be decided depending upon the value of the previous td, here is my hbs code, any help please?
<div class="row">
<div class="col-md-12">
{{#if model.novs}}
<table class="table table-striped">
<thead>
<tr>
<th>Notice#</th>
<th>Type</th>
<th>Violation</th>
<th>Inspection Item</th>
<th>
Action
</th>
</tr>
</thead>
<tbody>
{{#each model.novs as |nov index|}}
<tr>
<td>{{nov.NOVNumber}}</td>
<td>{{nov.NOVNoticeTypeName}} {{nov.ViolationTypeName}}</td>
<td>
{{#each nov.Violations as |novv index|}}
{{novv.ViolationNumber}}
{{novv.Year}}
{{novv.Make}}
{{novv.Model}}
{{#if novv.Vin}}(VIN#:
{{novv.Vin}})
{{/if}}
<br />
{{/each}}
</td>
<td>
{{#each model.result.items as |novi index|}}
{{novi.itemNum}}
<br />
{{/each}}
</td>
<td>
{{#if isResCompletedStatus}}
<div class="btn btn-xs btn-default" onclick={{action "editNov" nov.NOVId}}>
class="fa fa-eye">
<div class="btn btn-xs btn-default" onclick={{action "generatePreCase" nov.NOVId }}>
^__i class="fa fa-file">
Generate Investigation
</div>
{{else}}
<div class="btn btn-xs btn-default" onclick={{action "editNov" nov.NOVId}}>
^__i class="fa fa-edit">
Edit Notice
</div>
{{/if}}
</td>
</tr>
{{/each}}
</tbody>
</table>
{{else}}
{{#unless isResCompletedStatus}}
{{#link-to 'result.details.nov.details' 0 disabled=isResFormDisabledBoolean}}
<div class="well text-center no-margin">
Click here to add a Notice.
</div>
{{/link-to}}
{{else}}
<div class="well text-center no-margin">
No notices...
</div>
{{/unless}}
{{/if}}
</div>
</div>
In the above code, the model.result.items has Violation element, how can I display the novi.itemNum for the novv.ViolationNumber that is displayed, any help please - thanks in advance.
|
|
|
|
|
I understand your question but you posted too much HTML for me to figure out which "td" element your referring to, and you have no comments. Why post so much HTML?
Keep in mind that we can't read your mind when you post your troubled thoughts, and you have to help us along to tell the story again.
But on the other hand, it's really about working within the limitations of React, and using React HTML operators like "if", "switch" and so forth or building a better model to start with. If it's a violationType , then switch with that. I'm sure React has some support for containers and sections to hold the proper HTML based on a violationType for example.
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Yes I understand it, but I figured out that
|
|
|
|
|
js code that avoid plagiarism based on string
|
|
|
|
|
Sorry, but this is not a question.
"Five fruits and vegetables a day? What a joke!
Personally, after the third watermelon, I'm full."
|
|
|
|
|
It could be a crossword clue.
|
|
|
|