15,891,828 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by JackF007 (Top 10 by date)
JackF007
7-Jul-22 5:02am
View
Chris you're supporting my project a lot, so,first of all, thank you very much.
I would like not to use a different checkbox for each row as the row number could be different each time I load the page.
I want to apply your tip... as you can see I have used the checkbox as an innerHTML that took the content of the element with the id="myCheckboxId". Then I loop through each row here:
for (const row of datas.rows){
row.push(checkbox.innerHTML)
}
How I suppose to change the index of the checkbox for each row?
If I try something like this in the for loop:
document.getElementById("myCheckboxId").setAttribute("id", "myCheckboxId2");
it will change the id of the checkbox, but I guess it will not apply the CSS style for the class (each time the checkbox is clicked I basically change the style to see if checked or not), isn't it? Something like this:
.checkbox__input:checked + .checkbox__box{
background:#2266dc;
border-color:#2266dc
So as you said I should change the for attribute too.... to do that, do I need to setup for for each unique checkbox the style, the attributes etc?
JackF007
5-Jul-22 4:24am
View
Thanks again Chris... I will try to apply a solution based on your tips. I will update this questione once I proceed with a working solution.
JackF007
4-Jul-22 14:04pm
View
Great idea and very very useful tips... I think I will use it. I stil feel by the way that this will need lot of changes in the code. Is it never possible to render HTML elements on server side? There's no method to do this?
JackF007
4-Jul-22 6:21am
View
I need that on backend because my table takes the data from local system with " fs.readFileSync" method. The table is styled in the client-side. The checkbox element would be something I need to add to this table in order to allow row selection... for this checkbox I use HTML and CSS to style it, but I don't know if another method could be more functional... at the end of the day my objective is to allow the selection of the table rows and since that something is done in the backend for the table (where I take the data and put in the object dati{} (see comment above)) I supposed that was a got method.. but maybe not!!! Any other suggestion?
JackF007
4-Jul-22 5:36am
View
Thanks for your support, the problem is always the same. Everything is well now on the client-side, the checkbox is created,functional but I always need to pass it to my backend, maybe with a fetch API or something similar.... the problem is that I always need the checkbox also on the server side. How could I add an event listener without influencing the user experience...which one? And then even after that how I got the checkbox element in the backeend?
JackF007
3-Jul-22 14:50pm
View
The checkbox elements are created on the client side, but the table is populated in express server-side.
Client :
const checkbox = document.createElement("checkbox");
checkbox.classList.add("table-refresh__checkbox");
checkbox.innerHTML = `
`;
I would need to populated the table and the checkbox it should go in one column, the latest. Below the example from the server side, which get returned some data "directy" and one of them is the checkbox variable, which should contains the HTML element. Don't know if I explained well... but how I can request this element from the client to the server, for example using fetch API.
const data ={
headers: ["TipoDoc.","DataDoc.","Importo","CedentePrestatore","CessionarioCommittente"," "],
rows: new Array(i).fill(undefined).map(()=>{
x++;
return [dati[x][0],dati[x][1],dati[x][2],dati[x][3],dati[x][4],checkbox]
})
};
JackF007
29-Jun-22 8:21am
View
Imagine that I have this in my index.html file and I need to use it in node.js server (index.js) or app.js. Im my software the server send a GET request to the client app.js to take some data and compose a table.
when I use document.getElementbyId or server side I got a ReferenceError (document is not defined). I understand why this error, but then if I try the same on client (app.js), my checkbox is not defined on server side. How I could make all these "pieces" working togheter with this checkbox element?
JackF007
23-Jun-22 9:44am
View
Deleted
I tried, but unfortunately after changes is still return me: Cannot read properties of undefined ---
Even if I tried with just : "rows: new Array(10).map(callbackFn)" it returned me -- Uncaught (in promise) TypeError: Cannot read properties of null --
JackF007
23-Jun-22 9:41am
View
Deleted
I tried, but unfortunately after changes is still return me: Cannot read properties of undefined ---
JackF007
23-Jun-22 5:35am
View
Do you mean change the map call to ".map(callbackFn)" ? When I will return the dati[i][j] with that loop, will they populate the table properly given my input ['TD02', '2019-12-21', '30.71', 'GEA 2 s.r.l.', 'RENATO']? Like column 1 is TD02, coulumn 2 is 2019-12-21 etc?? And how to manage empy rows so that they will not be populated?
Thanks!!!!
Show More