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

w2ui 1.4.3. grid not displaying #1613

Closed
dregos opened this issue Jun 2, 2017 · 14 comments
Closed

w2ui 1.4.3. grid not displaying #1613

dregos opened this issue Jun 2, 2017 · 14 comments

Comments

@dregos
Copy link

dregos commented Jun 2, 2017

I have a previous version of w2ui 1.4.3.

If i inspect the Grid is there but is hidden. I see it generates column headers but without values (captions). I wouldn't be asking but I am using the w2ui 1.4 grid in several projects and it works everywhere but here I can't figure out what is wrong I've been at it a couple of days now.. A have checked the objects(columns and rows) generated and everything but can't figure out the reason for such behaviour. I would really appreciate if you could take a look, or at least point me in direction in which to look.

Console log is clean and there aren't any js errors. Here you can see the data object I've printed.
w2ui console log
Here you can see what is rendered on a web page
w2ui web printscreen
And here you can see the html element that is rendered,
w2ui rendered html result.html.txt

@chalchis
Copy link

chalchis commented Jun 2, 2017

The grid expects data in the JSON format from the server as it is described below. The JSON structure will be merged into the grid with jQuery.extend method. It means that you can return any supported grid property from the server and it will be applied.

{
    "status"  : "success",
    "total"   : 36,
    "records" : [
        { "recid": 1, "field-1": "value-1", ... "field-N": "value-N" },
        ...
        { "recid": N, "field-1": "value-1", ... "field-N": "value-N" }
    ]
}

@mpf82
Copy link
Collaborator

mpf82 commented Jun 3, 2017

The JSON structure will be merged into the grid with jQuery.extend method. It means that you can return any supported grid property from the server and it will be applied.

On a side note: even though this is still in the docs, this only applies to version 1.4 - w2ui 1.5 will no longer extend grid properties and only the following JSON properties are checked: status, total, records, summary.

@chalchis
Copy link

chalchis commented Jun 3, 2017

Thank you

@mrg2001
Copy link
Collaborator

mrg2001 commented Jun 3, 2017

@dregos can you please create a jsFiddle with the problem.

@dregos
Copy link
Author

dregos commented Jun 4, 2017

Hi. Thank you for the insight. how do I add resource link to w2ui in jsFiddle?

However.. I've used JSON stringify. And now I get "ERROR: Cannot add records without recid. ". I then added a column field with a name of "recid" but still the same.

@dregos
Copy link
Author

dregos commented Jun 5, 2017

I've upgraded w2ui to w2ui-1.5.rc1.min.
I can't recreate my code in jsFiddle because it needs https source. And when I try to point to git source it says it is in html/text format. (Console log: Refused to execute script from 'https://raw.githubusercontent.com/vitmalina/w2ui/master/dist/w2ui-1.5.rc1.min.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.)

This is the fiddle I've prepared, but there are no resources jet. If you can help me with that. It would be great. -> https://jsfiddle.net/dregos/z3u1p6dw/

@mpf82
Copy link
Collaborator

mpf82 commented Jun 5, 2017

There you go: https://jsfiddle.net/z3u1p6dw/4/

@dregos
Copy link
Author

dregos commented Jun 5, 2017

Thank you mpf82.. I've done the same, but should have apparently put in the right one. Well Now that we have a working fiddle it shows the same error with recid.

@mpf82
Copy link
Collaborator

mpf82 commented Jun 5, 2017

Now that we have a working fiddle it shows the same error with recid.

That's because you're converting your prefectly fine records (and columns) into a string:

generatedColumns = JSON.stringify(generatedColumns);
generatedRecords = JSON.stringify(generatedRecords);

You should also give the grid an absolute height in pixels instead of a relative height in percent:

https://jsfiddle.net/z3u1p6dw/6/

@dregos
Copy link
Author

dregos commented Jun 5, 2017

Ok I probably missed somewhere something. Because as I understood the problem was exactly that. That I passed an object instead of JSON string.

@dregos
Copy link
Author

dregos commented Jun 5, 2017

Why don't the first column items render?

@dregos
Copy link
Author

dregos commented Jun 5, 2017

Ok.. It seems the problem is in column property "render".

@mpf82
Copy link
Collaborator

mpf82 commented Oct 25, 2017

@dregos Is your problem solved now? Can this issue be closed?

@dregos
Copy link
Author

dregos commented Oct 26, 2017

Yes. It seems ok now. I’ve forgotten how I solved it but I think it is ok.

@dregos dregos closed this as completed Oct 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants