jQWidgets Forums

jQuery UI Widgets Forums Grid cellsformat in nested grid not working?

This topic contains 6 replies, has 2 voices, and was last updated by  Klaus H 11 years, 12 months ago.

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

  • Klaus H
    Participant

    Hi,

    I am using a nested grid and in the parent and child grid, I have a date column with a date object. In the parent grid, the date format works fine, the child grid ignores the format.

    if (grid != null) {
    grid.jqxGrid({ source: mysource, theme: mytheme, width: '95%', height: 100,
    columns: [
    /*...*/
    { text: 'dateregistered', datafield: 'dateregistered', width: 250, cellsformat: 'dd/MM/yyyy' },
    /*...*/
    ]
    });

    It doesn’t work with ‘F2’ either.

    Could you please look into that?

    Kind Regards
    Klaus


    Peter Stoev
    Keymaster

    Hi Klaus,

    The nested Grid is a completely new Grid instance independent from the Parent Grid i.e if there is a problem it is definitely not in the “cellsformat”. Please, provide a sample which demonstrates the problem on your side and we will be glad to test it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    Klaus H
    Participant

    Hello Peter,

    thaknk you for the reply. I knew that the grids are independet, I thought maybe it is a general problem with the nested grid.

    I used the nested grid example from your website to build my nested grid, but modified it by using two json requests. Then I wanted to build an example with the same effect using local variables for you to test and I had the same effect there. But before posting it, I looked at the text code some more and saw this section:

    var orderssource = { datafields: [
    { name: 'EmployeeID' },
    { name: 'ShipName' },
    { name: 'ShipAddress' },
    { name: 'ShipCity' },
    { name: 'ShipCountry' },
    { name: 'ShippedDate' }
    ],

    I added the types of the columns to this section and then it worked. I guess my date object was cast to string somewhere in the process. Maybe it would be good to add the types in the example, too – makes it easier to understand and to avoid the same mistake I made. 🙂

    Kind Regards
    Klaus


    Klaus H
    Participant

    Hello,

    I have a followup question to nested grids and didn’t want to open a new thread for that.

    For bulding a nested grid I take the records of an adapter, filter the records to my need into a new array, make a source out of this subset and define the subset as source for the new grid. The result is that I have a resulting number of grids with the same id (“grid” ).

    Now if I were to implement a cellsrenderer that generates me a delete button in each row of the nested grids and I would have the identifier of this rowdata, is there any way I can delete the data from that nested grid (would each nested grid have to have a seperate id for that?) and thereby the subset of the adapter records, the adapter records and thereby trigger the deleterow method of my original source to submit a request to the database.

    Is there any way to accomplish that?

    Kind Regards
    Klaus

    Edit: The ids of the nested grids are no longer a problem, that would be easy to fix in initrowdetails. So I would be able to remove the row from the grid, but can I trigger the deleterow method from the adapter?


    Peter Stoev
    Keymaster

    Hi Klaus,

    If the data adapter for the nested grid is built in the initrowdetails callback, the process of deleting a row and synchronization is the same as for a normal Grid, the different part is that the code should be written in the initrowdetails callback.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/


    Klaus H
    Participant

    Hello Peter,

    the data adapter for the nested grid is built outside of the initrowdetails, the initrowdetails just selects the records and make a local source of the subset of necessary data.

    But my thinking was off, I assumed the initrowdetails is called and the data selected each time the row details are opened and shown and hence I would need to delete the record from my original adapter. But my testing (without the syncronization to the database yet) after your comment shows if the data is deleted from my local source, that’s the right place to call the deleterow method.

    May I say, nested grids are a very cool feature. 🙂

    Kind Regards
    Klaus


    Klaus H
    Participant

    Hi Peter,

    the initrowdetails method is called again, after I force the grid to be rendered again (this is for layout reasons). If I delete a row in a nested grid and handle the deleterow just in the subset source (which in your nested grid example would be orderssource) and the grid is rendered again without reloading, I need to remove the record from the original datasource (in your example the ordersDataAdapter).

    What is the best way to do this? I haven’t found an example on how to remove a record from a dataadapter? Or do I have to remove it via .records?

    Kind regards
    Klaus

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

You must be logged in to reply to this topic.