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

Question about developments about new version 1.5 and old version 1.4.3 #1351

Open
spizzi77 opened this issue Oct 10, 2016 · 18 comments
Open
Labels
1.5 1.5 branch / release Question

Comments

@spizzi77
Copy link

Hy all,
I have some question that i'd like to know, i'm using w2ui 1.4.3 in a big data project with a lot of management of data, so i have w2ui grid all custom both for ajax response null, ok, ko, error, for example many columns tables has the render function to insert a class in the div td because i need with $(classTD).each(function(){this.text}) to read the data and make controls, all expanded grid, all this to say that w2ui is used a lot and a lot customized in my project.
If i read well the 1.5 version will not have the compatibility with the 1.4.3 version, but sincerely i can't change all the file in the project, we speack about 100 javascript file, so i'd like to know both if will be a migrate file for example and if this will not, for sure all the documentation of w2ui 1.4.3 will be remain online?
Thanks in advantage, and boys w2ui grid is the best object that i never seen, all can be done and managed with w2grid...Well done.
Andrea

@aswzen
Copy link

aswzen commented Oct 11, 2016

this is what i worry about
.. the 1.5 w2ui form send different format data to the server not like the old one (1.4)

@spizzi77
Copy link
Author

I think and hope that Vitmalina will think to this problem, because otherwise all people that today are using 1.4.3 version in a big project in production-work they can't use the new version, i tested the 1.5 version and calling the DB with grid and subgrid seems work the only problem i notified was a css problem of expansion grid, but there are a lot of other not compatibility and this is a problem imho.
Maybe a solution can be renamed the object for example w2grid15 so they can live together and the user can use or the old one or the new one, the first solution that i can think but for sure Vitmalina know better how to do.Othervise i must use the 1.4.3 version for always because the javascript is in the header and the header is in all project so or i do a new folder with a new header or i must use the 1.4.3, but i feel good with the 1.4.3 version, hope that the documentation will remain online.

@aswzen
Copy link

aswzen commented Oct 17, 2016

@vitmalina hello vitmalina any update about "the 1.5 w2ui form send different format data to the server not like the old one (1.4)"

thank you

@spizzi77
Copy link
Author

The problem is that the future w2ui 1.5 will receive for example in data expanded grid both father that children in json in an unic call, instead now you can do a call when click the "+" of the expanded row.
This is a first problem, i work in a big data management and i can't call the DB to receive all data in an unic call, because it's a really problem, for example i have a project where the first call receive about 100-200 records and for every records if i expand the row i have 2-3 thousend sub-records i can't download ALL the records in an unic call, i notified also that some browser like as IE11 for example are not so reactive to scroll all serach all the data, the secondo problem is that all my grids are customized in refresh and onLoad and also this will not compatibile, btw i have 40 grid in all the project.Now IMHO i think the the compatibility from an old version and a new version is a MUST, when i did fractal formule the first thing that people said to me was just keep the compatibility from an old formula and new update otherwise the fractal is broken and the user loose it.
Now i will adapt me but for sue if 1.5 is not compatibile with 1.4.3 i will use 1.4.3...But allow me to say again that a project like w2ui MUST keep compatibility between versions.
Good day
Andrea

@mpf82
Copy link
Collaborator

mpf82 commented Oct 18, 2016

I've started my project with 1.4.3 but migrated to 1.5 shortly after I started, so I know a bit about the differences.

For the fun of it, I just downgraded my w2ui sources to 1.4.3 and had very minimal effort to get everything working again.

With 1.5:

2016-10-18 10_03_00-nemetris web template - v1 1

With 1.4:

2016-10-18 09_29_57-nemetris web template - v1 1

These are the changes I had to make to make my 1.5 stuff work with 1.4.3:

  • w2layout does not support onContent so I had to use setTimeout() after loading the content to delay the function calls that were in onContent

  • The commands for get/delete/save have changed, so I had to adapt my server function to accept the "alias" names:

    if(cmd in ('get', 'get-record', 'get-records')):
        result = self.w2ui_postdata_handler_get(params)
    elif(cmd in ('delete', 'delete-record', 'delete-records')):
        result = self.w2ui_postdata_handler_delete(params)
    elif(cmd in ('save', 'save-record', 'save-records')):
        result = self.w2ui_postdata_handler_save(params)
    
  • fields of type list with an url attribute expect the server result to provide items while 1.5 expect records (but still accepts items for backwards compatibility).

  • the form's header CSS was no longer compatible with my additional header buttons, so I removed them to not invest too much time in this

  • as you can see in the screenshots, there are still a few differences, e.g. the scrollbar in the menu or the form's field all below each other (because 1.4 does not support column layout for auto-forms) or the grid header and buttons not having the correct color (because CSS has changed a bit).

  • there are no w2utils.formatters in 1.4, that's why the pictures in my grid no longer render - instead the picture's base64 data is displayed.

  • One of the biggest traps IMHO is that the default AJAX type change in 1.5, so you must make sure to set it correctly before requesting data from the server. In my case, I use:

    // set data type for server communication
    w2utils.settings.dataType = 'JSON';
    

All in all I must say that it took my less than an hour to fix the issues I encountered from downgrading from 1.5 to 1.4.3, so I guess upgrading from 1.4 to 1.5 can't be such an issue either.

By the way, I'm also using sub-grids and I request their content when they get shown/expanded. I'm not planing on using the new tree-like grids, simply because I need to get data from different tables and the tree-grids don't have their own columns for sub-data.

Sub-grids are still working fine in 1.5, even if they are no longer officially supported and you need to set the height "manually".

I agree that there should be some sort of documentation that lists all the major differences and gives a hint on how to adapt the code, but maybe we users should just start to write up our experiences with the code migration.

@spizzi77
Copy link
Author

Hy Mike,
I did a quick experiment using w2ui 1.5 and i notified that is changed also some class used in the grid, yes i can help to try to write a sort of migration, but for the grid.I explain better, i use a lot of grid because i do managment of data from the web downloading data from DB2 so in the server i do all the controls for every row if necessary because if in the row is present for example a particular code i must do a function otherwise another function and so on, this is in general what i do, so when server(PHP) answers to client w2ui in w2ui i able or disable buttons for example...Another function that i use is the control of every row in jquery and to do this i use usally a class in the row, $('.className').each(function(){$(this).text() }) if text is ITALIA i do some control otherwise other controls, so in the w2ui i must use the render function to add a class(to remain the old controls in javascript, the project is big), because the old project code was done all in server-side, so from php was created with a class template the html that creates the header table and inside the foreach loop the rows and out the loop was created the template close table, all this was in php with a template class(file_get_contents, and passing variables to html from php in array('myVariable' => $myVariable)) and take in html with {myVariable}, when i introduced w2ui for sure i managed the same controls via server but returning a json and after manage data from the client.
Now you can image that in the refresh function and rendering rows i able diasable button allow checkbox check or not etc...etc....All the onLoad or onError is customized, it's a big work of analisis because there are a lot of data and management, if the problem is only rename some class or changed the recid name it's ok but if the problem is all the logic inside it's difficult....I can try to reinstall the 1.5 version and look about differences and try a solution global that allow me to migrate from a version to other, but for sure i don't know if my solution it's ok for other people, i find a solution for my code i can't know all the changed done from 1.4 to 1.5, also because i haven't time to study it, we must know that also if a class name changed we broke the compatibility.
We will see what happen....
Bye

@integrateddigital
Copy link

@mpf82 Thanks for your post. Really useful.
This is the issue that I'm encountering with 1.5 ..

  1. .json records with colour via string ( ....,"style": "color:red",... ) stopped working, no colours .. it works
    when I switch back to 1.4.3 ( ps: same happens if object is used in lieu of string, same happens=no colours, whatsoever, also in this case migrating back to 1.43 fixes it without any code change )

  2. Not sure if related, but I noticed that 1.5x's grid does load a .json that do -not- contain
    the struct header records ( i.e.: {records:[ ......... ) as opposed to only [........] ... I wonder if this
    is related to the colour issue fixing a typo #1 above.

  3. Server response.. I will try the alias solution mpf82 kindly placed earlier in this thread before raising any further flags...

I've been using w2ui for some time, and I also wish to congratulate the author @vitmalina and all of you; it is truly a great library. I apologise if this has been addressed somewhere else, I did
went through the issues but could not find any -recent- issues on this.

Hopefully someone will shed some light on the colour issue, it's really a problem for my implementation ( we use colour codes to display server statuses ......... ). Please let me know if a ticket should be opened or not.
thanks and cordially,
Sergio

@mpf82
Copy link
Collaborator

mpf82 commented Oct 21, 2016

Hi Sergio,

about your first issue: w2ui related record attributes must be moved to record.w2ui

From the current w2grid.js:

move rec.summary, rec.style, rec.editable -> into rec.w2ui.summary, rec.w2ui.style, rec.w2ui.editable

So if your record previously looked like:

{ recid: 5, first_name: "Steve", style: "color: red" }

then in 1.5 you need to use:

{ recid: 5, first_name: "Steve", w2ui: { style: "color: red" } }

By the way, 1.5 does support rec.w2ui.class in case you want to use a CSS class instead of the style attribute.

Maybe it helps to search your w2ui.js file for the string 1.5 changes, because vitmalina added comments for most of the relevant changes in the header of the source files. Or instead of searching the w2ui.js file, you could take a look in the specific source files in the src folder.

Update: the "changes" comments will be removed from the source files, as the changes are being moved to the 1.5 docs: http://w2ui.com/web/docs/1.5/

Update 2: the w2ui specific properties that are moved to record.w2ui are colspan, editable, changes, children, parent_recid, summary, style, class (this list is taken from the source code comments, don't shoot me if those properties may change in the future).

Cheers, Mike

@integrateddigital
Copy link

Hi Mike,
Many thanks on your reply. It worked, colours are back.
I was going to ask just that, about classes and 1.5 documentation... will report back on #3.
again, thank you and cheers.
s

@spizzi77
Copy link
Author

Hy All,
I'm testing the versions because in some moment is better use the 1.5 and other moments 1.4.3 :) for example the 1.5 versions when i resize column insert the scroolbar under the last row and this is ok, instead the 1.4.3 no but the scrollbar is over the last row.So i have implemented some code of the 1.5 inside the 1.4 and now it's ok the scrolbar is under the last row, but there is a problem in the 1.5 version, i have many grid inside folders loading on document ready and seems that 1.5 version doesn't show well the contents of the rows, but if i resize columns the vision is ok.I think this problem is born from the resizeRecords and in paticular here:

        // find width of frozen columns
       var fwidth = 1;
        if (this.show.lineNumbers)  fwidth += lineNumberWidth;
        if (this.show.selectColumn) fwidth += 26;
        if (this.show.expandColumn) fwidth += 26;
        for (var i = 0; i < this.columns.length; i++) {
            if (this.columns[i].hidden) continue;
            if (this.columns[i].frozen) fwidth += parseInt(this.columns[i].sizeCalculated);
        }
        fcolumns.css('width', fwidth);
        frecords.css('width', fwidth);
        fsummary.css('width', fwidth);
        scroll1.css('width', fwidth);
        columns.css('left', fwidth);
        records.css('left', fwidth);
        summary.css('left', fwidth);

@mpf82
Copy link
Collaborator

mpf82 commented Oct 24, 2016

Hi Andrea,

can you create a fiddle to reproduce your problem?

Can you also try to set this grid property and see if it makes a difference for you:

grid.disableCVS = true; // disable virtual column scrolling

(you should probably set this property in your grid constructor)

@spizzi77
Copy link
Author

Hy Mike,
Now i'm at work, i only tried to switch the old code from 1.4.3 to 1.5 and there are differents problematics in jquery folders plugin, but i didn't do changes to the code, just keeping the old code both for server that for client but inserting the 1.5 javascript file so can be this the problem for sue i must adapt and re visiting all the old code to the new version.
I'll try to look better and give you some example on my site default page....
Bye Andrea

@spizzi77
Copy link
Author

Hi again Mike, nothing, i decided to remain the 1.4.3 version(for the moment) at work instead on my personal site i will use the future 1.5 so to see better the changes and how to fix it, because at work the project is too big and there are a lot of functionality, i notified that for example doing a resize grid at document ready and inserting differents grids into folders(we use jquery folders plugin) it's ok with the 1.4.3 instead the 1.5 doesn't do the resize and i don't know why, the logic is simple at document ready if w2grid['nameGrid'] is !== undefined resize it, it works in 1.4.3 but not in 1.5, i create template from php inside the folders and inside the template there is the grid, sincerely at work there are a lot of changes to do because now that i use 1.4.3 in production is all stable all is working fine, i will think in the future but for the moment i remain with 1.4.3.
Later
Andrea

@integrateddigital
Copy link

@mpf82
Hi Mike,
In regard to the other problem; of which I've been stuck for 2 days now, the following is happening:

  1. Post requests get cancelled
  2. Toolbar on; event is Delete; using url 'remove: router.php'
  3. Tried all browsers
  4. Tried all php.inis / apache ( ignore_user_abort = on ; everywhere )
  5. But going from 1.5x to 1.4.3 fixes it; ...

Have you or anyone experienced this ? The only reference I could find within the repository was issue #623 but it seems to be a different context.

Any help would be much appreciated, this is literally driving me crazy.

many thanks,
cordially,
Sergio

image

@mpf82
Copy link
Collaborator

mpf82 commented Oct 27, 2016

Hi Sergio,

not sure what's happening on your server side, but my suggestion is to check the request headers and request payload in your browser's network tab. Compare them (1.4 vs 1.5), maybe you'll find the difference.

Also make sure to set w2utils.settings.dataType to whatever fits your needs (w2ui 1.4 default is HTTP, w2ui 1.5 default is HTTPJSON).

I'm using Python and CherryPy server, so I don't have specific recommendations for PHP and Apache.

Best regards,
Mike

@aswzen
Copy link

aswzen commented Oct 28, 2016

you should remove the 1.4.3 library especially on home page download button as soon as possible..
because its like you just make a trap, they downloading something that will be deprecated (not usable with the new one)

@mrg2001
Copy link
Collaborator

mrg2001 commented Nov 4, 2016

I have posted 1.5.rc1 to the website and removed links to 1.4. Documentation is also available for both of them on the website (for 1.5 whatever current state is, it is somewhat incomplete yet).

@mrg2001 mrg2001 added the 1.5 1.5 branch / release label Nov 4, 2016
@integrateddigital
Copy link

Thanks Mike ( @mpf82 ) ! ... I hadn't replied to you, sorry. The cause was a null value, just prior
of the event triggering ( onDelete ), it triggers 2 requests - and the faulty one indeed has
an unique header - thanks for the suggestion.
Thanks for your kind attention.
best
s

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.5 1.5 branch / release Question
Projects
None yet
Development

No branches or pull requests

5 participants