jQWidgets Forums

jQuery UI Widgets Forums Grid Column data lost after column resize / reorder

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 3 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • HeinoVDS
    Participant

    Hi,

    I’m researching if / how we can use Java / AngularJS / jQWidgets as a replacement for our current programming environment. At the moment I’m trying to write a test case that simulates one of our current programs. To get the correct data in a column, I’m trying to use the cellsrenderer function combined with the bindingcomplete event to replace the default HTML with a AngularJS directive that reads the correct data from the server and inserts it in the column.
    After researching a lot (I’m new to Java, Javascript, AngularJS, …), I got this working in such a way that the data appears in the column. But when that column is resized or reordered, the AngularJS directive I had in that column is removed by jQWidgets (I assume).

    Is there anything I can do about this? Or is there another way I can use to get the data from the server in the grid? I tried reading the data in the cellsrenderer function, but because of the asynchronous nature of the request (At least, I suspect this being the reason) the cellsrenderer function is completed before I get the answer from the server.

    Any help would be greatly appreciated,

    Heino


    Peter Stoev
    Keymaster

    Hi Heino,

    “cellsrenderer” returns HTML String and it called on each rendering operation i.e you should not take into account that this is something static which is performed just once on binding complete. It is not appropriate for your scenario. To learn how to bind jqxGrid to either Local or Server Data, look at: http://www.jqwidgets.com/jquery-widgets-documentation/documentation/jqxgrid/jquery-grid-datasources.htm

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com


    HeinoVDS
    Participant

    Hi Peter,

    Thanks for looking at my problem…
    I’ve been looking at the link you supplied, but I don’t see how it will solve my problem. As i said; I’m rather new to all this, so I’m probably missing something stupid…

    Anyway, let me explain in more detail what I’m trying to do:
    I’m showing a grid that’s filled with order lines. These order lines are read from the server and I’m using a data adapter for this that uses an url to contact the server and receives a JSON file / object in return. This data is shown in the grid, and everything works perfect with this. Now, two fields in this data together form the key to an item and the corresponding description for this item (stored in another table) should also be shown in the grid. As I said before, I tried using the cellsrenderer function to get this description from the server, but the asynchronous nature of the request makes that this doesn’t work.
    At the moment I use the cellsrenderer function to add some extra info to the cell’s HTML and afterwards I use the bindingcomplete function to replace that HTML with an AngularJS directive. It’s this directive that uses the added extra info and reads the description from the server and because Angular automatically updates the DOM when the data changes, the description is correctly shown in the grid. (Until the column is resized / reordered)

    On the page you linked me to, there is an example that shows how to link two data adapters (Orders and Employees) to get some extra information to show in the grid, but if I understand that example correctly, all the data from the Employee adapter is automatically loaded before any data is shown in the grid? If so, this wouldn’t work for us, because the table that contains the descriptions is much to big. So I’m searching for a solution that would let me only read the few descriptions I actually need and shows them in the grid.

    I can’t imagine that this is something that hasn’t been needed by someone else before me, so I guess (hope) I’m missing something fundamental here… Feel free to enlighten me…

    Kind regards,
    Heino


    Peter Stoev
    Keymaster

    Hi Heino,

    Yes, there is example that links 2 dataAdapters on the page which I pointed you and it is also true that one of the adapters should be already loaded with data in order to use that data as a data source for the second data adapter. No, you cannot dynamically load data from another table in jqxGrid via cellsrenderer. It would not be ok to make Server Calls in cellsrenderer, too, because you will end up with too many such calls.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.