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

Comments

Projects
None yet
3 participants
@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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Author

mawasak commented Jul 16, 2018

@Jand42

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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 in a0e9952 Jul 24, 2018

@Tarmil Tarmil added the 4.4.1.137 label Jul 31, 2018

@Tarmil

This comment has been minimized.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.