Here you made nTabCols a reactive variable, and you have a view/projection of it (via textView) into markup. As each table header column is generated with this projection as its content, they get updated when nTabCols is incremented in your for loop. This means that by the time the entire header row is computed, nTabCols will be 8, and so all header columns will have 8 as well (after each cell going through changing their content (8-i) times.)

Short story: using a Var here is an overkill and unnecessary, simply iterate through with i and use its value - like you said.

I also noticed that you are using WebSharper.UI.Next - this library is now moved to WebSharper.UI and the HTML combinators there no longer need xxxAttr forms, but instead have two list arguments - one for attributes and one for inner elements. You might want to update to WebSharper.UI - it is the recommended view library now.

By on 1/18/2018 10:41 AM ()

Adam, thank you to explain me how Var works. I was trying to follow an example to understand how WebSharper works. By the way, I tried to use WebSharper.UI, but I got an error: the project doesn't find it. I updated the framework to the last version. I will try again. Thank you again.

By on 1/18/2018 2:18 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us
Built with WebSharper