jQWidgets Forums

jQuery UI Widgets Forums Grid jqxgrid with property autorowheight and cellsrenderer

This topic contains 8 replies, has 2 voices, and was last updated by  dmesabar 5 years ago.

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

  • dmesabar
    Participant

    Hi,
    I have a jqxgrid with the property autorowheight to show all content of text.
    The problem is when once of cell have a function cellsrenderer, this cell lost or not calculate the margin-top
    jqxgrid autorowheight and cellsrendered
    On image, the column Value have the function cellsrenderer and the first line dont calculate the margin-top.

    
    var cellsrenderer_value = function(row, column, value, defaulthtml, columnproperties, rowdata) {
    return $(defaulthtml).html(toFixedFormat(value,2))[0].outerHTML;
    };
    

    The column quantity dont have the function cellsrenderer and the margin-top is calculate
    How can solve?
    Thanks.


    Hristo
    Participant

    Hello dmesabar,

    It is expected behavior.
    The cellsrenderer callback is used to fully override the content of the cells.
    You could get the settings from the defaulthtml argument (4th argument).
    For this purpose, you could calculate it and return the right one.
    Please, take a look at this example.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    dmesabar
    Participant

    Hi Hristo,

    You can see the example
    I add on quantity cell the function cellsrenderer
    On grid result, you can see how the values not change the margin-top to stay center.

    Thanks.


    Hristo
    Participant

    Hello dmesabar,

    Thank you for this feedback.
    I will create a work item for this.
    But if you provide me more details about what is your final goal then I will understand your case well.
    After that, I could try to provide you a solution.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    dmesabar
    Participant

    Hi Hristo,
    My grid have a few cell with calculations.
    I will have the columns, among others, Quantity, Price, Total…
    Total = Quantity * Price
    Some cells, I need to calculate the value and only I can set the value with cellsrenderer
    Thanks.


    Hristo
    Participant

    Hello dmesabar,

    There are different approaches.
    One is that you try.
    Another option that you could try to pre-calculate the data is before it will be loaded into the jqxGrid.
    For this purpose, the beforeLoadComplete callback it will be better to use for this case.
    Please, take a look at this demo.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    dmesabar
    Participant

    Hi Hristo,
    I think that use beforeLoadComplete isn’t solution for this purpose.
    My jqxGrid have the cells quantity and price editables. When one of cell is edit, automaticly will be calculate the total.
    For this reason, I think that the best solution is use cellsrenderer.
    Thanks.


    Hristo
    Participant

    Hello dmesabar,

    You could use the setcellvalue method in case of using the beforeLoadComplete callback.
    Depends on the changed value in one of the mentioned columns then change the value in the total column.
    I understand you.
    Thank you for your patience.
    I will create a work item for this case.
    Please, let me know if you have any other questions.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    dmesabar
    Participant

    Hi Hristo,
    I know that I can use the setcellvalue on the cells that I need.
    I simplified the exemple to see that the margin-top is not calculate when the cell have the function cellsrenderer
    In my grid I will have more cellsrenderer, for example, to put buttons and/or icons and depends of more options to show this buttons.
    Thanks for create a work.
    I will wait for news.

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

You must be logged in to reply to this topic.