jQWidgets Forums

Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • in reply to: Wordwrap in cells Wordwrap in cells #13312

    psoto
    Member

    Thanks!

    I hope I’m able to paste it correctly now 🙂

    Regards,
    Paulo

            $("#jqxgrid").bind("bindingcomplete", function (event) {
    WrapText();
    });
    function WrapText() {
    for (i = 0; i <= 10; i++) {
    WrapRow(i);
    }
    }
    function WrapRow(number) {
    var currentRow = '#row' + number + 'jqxgrid';
    var arr = $(currentRow + ' .jqx-grid-cell-workgroup span');
    var hOfRow = $(currentRow).height();
    var hOfSpan = $(arr[1]).height();
    var hToIncrease = hOfSpan - hOfRow;
    if (hToIncrease > 0) {
    hToIncrease += 5;
    IncreaseSize('#jqxgrid', hToIncrease);
    IncreaseSize('#contentjqxgrid', hToIncrease);
    IncreaseSize(currentRow, hToIncrease);
    MoveDown('#pager', hToIncrease);
    }
    }
    function IncreaseSize(element, pixels) {
    var current = $(element).height();
    $(element).height(current + pixels);
    }
    function MoveDown(element, pixels) {
    $(element).css('top', '+=' + pixels);
    }
    in reply to: Wordwrap in cells Wordwrap in cells #13309

    psoto
    Member

    Looks like I’m not being able to paste the code without getting it truncated.
    Please, let me know if anyone still needs it and I can send it by email.

    Thanks!

    in reply to: Wordwrap in cells Wordwrap in cells #13305

    psoto
    Member

    Hi All,

    I’m really sorry! I have just noticed that the code I pasted had some parts missing!
    I have just taken a look at how I implemented and I’m pasting it again here. I hope nothing is missing this time!

    Just an FYI, “workgroup” is the name of the Theme I used for the Grid. You will have to change it to whatever theme you are using.
    Again, I know it’s not the best solution, but it’s the only one I could find as a work-around.

    Thanks!
    Paulo

    function WrapText() {
    for (i = 0; i 0) {
    hToIncrease += 5;
    IncreaseSize(‘#jqxgrid’, hToIncrease);
    IncreaseSize(‘#contentjqxgrid’, hToIncrease);
    IncreaseSize(currentRow, hToIncrease);
    MoveDown(‘#pager’, hToIncrease);
    }
    }

    function IncreaseSize(element, pixels) {
    var current = $(element).height();
    $(element).height(current + pixels);
    }

    function MoveDown(element, pixels) {
    $(element).css(‘top’, ‘+=’ + pixels);
    }

    in reply to: Wordwrap in cells Wordwrap in cells #3875

    psoto
    Member

    Hi DH,

    Today I was having the same problem, so I decided to use some JQuery code to adjust the height of the rows dinamically.
    Basically what I do is getting the height of the inner span that contains the text at the column that I wanted to adjust and compare it against the row’s height.
    If it needs to be adjusted, what I do is increase the height of the Grid (jqxgrid), increase the height of the Content (contentjqxgrid) and increase the size of the row. Finally, I move the pager down.

    I execute the above code at the bindingcomplete event:

    $(“#jqxgrid”).bind(“bindingcomplete”, function (event) {
    WrapText();
    });

    This is the executed code:

    function WrapText() {
    for (i = 0; i 0) {
    hToIncrease += 5;
    IncreaseSize(‘#jqxgrid’, hToIncrease);
    IncreaseSize(‘#contentjqxgrid’, hToIncrease);
    IncreaseSize(currentRow, hToIncrease);
    MoveDown(‘#pager’, hToIncrease);
    }
    }

    function IncreaseSize(element, pixels) {
    var current = $(element).height();
    $(element).height(current + pixels);
    }

    function MoveDown(element, pixels) {
    $(element).css(‘top’, ‘+=’ + pixels)
    }

    I know it’s not the best solution, but it worked for me.
    I hope it could also help you.

    Regards,
    Paulo

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