jQWidgets Forums

jQuery UI Widgets Forums Grid jqxgrid selectedrowindexes add icon in rows

This topic contains 7 replies, has 2 voices, and was last updated by  Hristo 8 years, 1 month ago.

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

  • dan123
    Participant

    Hi I have this grid with custom checkbox, with the pagination being able to select by page. The problem i have is that whenever I use the checkbox to select all by page and click on the button to add the icon, its adding the icon to all rows in every page. I only want to add the icon to selected rows only. This is weird but it works when i dont use select all. I would appreciate your help thanks.

    Problem example:
    Select all using the checkbox and click “Add Icon” button, now notice it does add the icon but check the other pages it has also added to all of them.

    Needed:
    Select all using the checkbox and click “Add Icon” button. the grid should show icon for only selected rows

    Note: Use setcellvalue to add icon

    Here is my jsfiddle:
    http://jsfiddle.net/axujkwrv/182/


    Hristo
    Participant

    Hello dan123,

    It is one very customized example.
    I would suggest you as an alternative “getselectedrowindexes” because you use another logic to select all rows to use getrows.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    dan123
    Participant

    Hristo, please I really need help on this. I have been trying to create another logic but no luck.

    Here is my jsfiddle:
    http://jsfiddle.net/axujkwrv/189/


    Hristo
    Participant

    Hello dan123,

    I mean to get the current state of the rows with getrows and again with for loop to iterate all items and check for these of them that have ‘true’ value for the “available” column.
    For these of them add icon.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com


    dan123
    Participant

    Hi Hristo,

    I did exactly what you said but I noticed the problem occurs when suppose there are 10 rows and you added icons to 9 of those rows. So whenever all rows has the icon it cause all the pages to have that same icon across.

    Example of problem:
    Unselect atleast one row and then click add. Now check the pages they seem fine for now. But now select the row that you did not choose and click the add button. Now check other pages they have the icons too.

    Here is the updated jsfiddle:
    http://jsfiddle.net/axujkwrv/195/


    dan123
    Participant

    Hi Hristo,
    I tried using the image widget column, and I was wonder if I could use setcellvalue to show the icon. Because otherwise the icons dont stay there inside the cell using .show();

    Here is my jsfiddle:
    http://jsfiddle.net/3onsL31w/11/


    dan123
    Participant

    Hi Hristo,

    I realized the problem it is because of adding images to a column. I tried to add text to the column and the select all functionality worked. But when I add image/icon it adds to all pages. I still do not know how I can fix this or any work around will help please. Check my previous two posts to see whats the problem.

    Here is my jsfiddle:
    http://jsfiddle.net/axujkwrv/195/


    Hristo
    Participant

    Hello dan123,

    I would like to suggest you another approach – you could try to use $("#jqxgrid").jqxGrid('updaterow', rowIDs, newRows);

    Also, one more way, you could use this button only to refresh the Grid and you could implement cellclassname or cellsrenderer callbacks and there you could check if the ‘available’ column is true or false.
    Depends on this to add or delete an icon.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.