• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Auto Increment Row number

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi !
In our application,We need to display the content of a CSV file in a table format. So I browsed over net and got some conversion(csv to table) codes.
But the problem is, the row numbers should be displayed in a separate column in the table(which was not in my code).
So suggest me how could I do that?

Thanks in advance.


Regards,
Steve.
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The easiest way is going to be completely dependent on how you're doing the CSV to Table conversion. Can you describe how that works?
 
Stevenson Anderson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Brown! I am not much aware of these coding. But I will try to explain.
In the script file 2 functions are used.One is splitCSV(This function takes the csv file path as an argument and splits the content of the file using comma)
and the second function is CSVtoTable function(this functions displays the content of the file by using predefined style sheets). I could not able to understand the code clearly.
So I just to post the code.



So suggest me how can I do it?
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Find the code where you generate a row of the table. Insert code after where it generates the row header (the <tr> element) to generate an extra cell containing the line number.

You'll also need to generate a column heading for those cells, even if it contains nothing. So find the code where you generate column headings, and insert code to generate this extra column heading before where it generates the normal column headings.
 
Stevenson Anderson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Paul I will try to do that..!
 
No more fooling around. Read this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic