Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table instantiation (rows above table header when ClientLoad.FromDocument) #184

Open
mawasak opened this issue Jul 15, 2018 · 8 comments
Open
Assignees

Comments

@mawasak
Copy link

mawasak commented Jul 15, 2018

Hi,
My table rows are above table header when I use ClientLoad.FromDocument.

image

I use Adam article https://forums.websharper.com/blog/84145

My modifications are here
https://github.com/mawasak/websharper-table

and some screenshots:
Code in Main.fs

image

Templates in Main.html

image

packages.config (newer versions than in mentioned article)

image

Without , ClientLoad.FromDocument, ServerLoad.WhenChanged

image

Regards,
Mariusz

@Jand42
Copy link
Member

Jand42 commented Jul 16, 2018

Hello,

this seems like something that should have been fixed by 1298d14 but your version of WS is later.

Have you tried latest release (4.4)? Can you push the entire sample project so its easy to reproduce? Thanks a lot!

@mawasak
Copy link
Author

mawasak commented Jul 16, 2018

I don't try 4.4 yet.
I pushed full project here https://github.com/mawasak/websharper-table a moment ago

Write if you need more info.

@mawasak
Copy link
Author

mawasak commented Jul 16, 2018

@Jand42
Copy link
Member

Jand42 commented Jul 16, 2018

@mawasak Thanks! I will look into it soon.

@Jand42 Jand42 added the bug label Jul 17, 2018
@Jand42 Jand42 added this to next minor in Releases Jul 19, 2018
@Jand42
Copy link
Member

Jand42 commented Jul 19, 2018

@Tarmil The html as returned by the server contains this: <tbody><div ws-replace="MyTableHole"></div></tbody>, so a ws-hole is transformed to a child element with ws-replace. My guess that the problem lies in that it is a <div>, independent of the containing element, it should be <tr> here.

@mawasak
Copy link
Author

mawasak commented Jul 23, 2018

Code returned from server is like @Jand42 said, but in WebSharper.UI.Client.Templates.LoadNestedTemplates (root: Element) baseName
root contains

<div ws-replace="MyTableHole"></div><table class="table table-bordered">

so MyTableHole div is before table tag (tbody is empty)

</thead> <tbody></tbody> </table></div>

@Tarmil
Copy link
Member

Tarmil commented Jul 24, 2018

This is indeed a similar issue to the one fixed by 1298d14. The common problem is that some elements can only have certain specific children (such as <table> can only have <tbody> or a couple others), so if that's not the case then the browser alters the DOM. 1298d14 fixes the way we output nested ws-(children-)templates to account for this; the present issue is about ws-replace and needs a similar fix. I'll have it ready soon.

@Tarmil Tarmil closed this as completed in a0e9952 Jul 24, 2018
@Tarmil Tarmil removed this from next minor in Releases Aug 1, 2018
@Tarmil
Copy link
Member

Tarmil commented Aug 7, 2018

Reopening as this issue still happens with SVG. Example:

<svg>
  <g>
    <circle ws-replace="MyCircle" />
  </g>
</svg>

incorrectly becomes:

<svg>
  <g>
    <div ws-replace="MyCircle" />
  </g>
</svg>

@Tarmil Tarmil reopened this Aug 7, 2018
@Tarmil Tarmil added this to next minor in Releases Aug 15, 2018
@Jand42 Jand42 removed this from next minor in Releases Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants