3.0.0

checkbox

Hi there,

i may be doing somethig really stupid but the checkboxes on my grid are just not showing up. i wonder if there is a property to be set to make them visible. I tried copying the code from the example that shows the checkbox but even that is not show the checkbox in my project. Ive looked thru a lot in the forum but nothing is helping. Any leads will be greatly appriciated.

var grid = new AW.UI.Grid;
    grid.setId("myGrid");
    grid.setCellData(function(col, row){return "cell " + col + "." + row});
    grid.setColumnCount(5);
    grid.setRowCount(20);
    grid.setSelectionMode("multi-row-marker"); // set selection mode to multiple rows with checkboxes
    
    //grid.setCellTemplate(new AW.Templates.Checkbox, 0);
    //var chk = new AW.Templates.Checkbox; 
    //grid.setCellTemplate(chk, 0);
    
    grid.refresh();

    var label = new AW.UI.Label;
    label.setId("myLabel");
    label.refresh();

    grid.onSelectedRowsChanged = function(rowIndicesArray){
        label.setControlText("rows: [" + rowIndicesArray + "]");
    }
IS
June 29,
guys i can see the extra space on the left side of the text where the checkbox should be but i dont see the checkbox itself. Could this have something to do with the css ?
IS
June 29,
Did you copy the image file (checkbox.png)?
Alex (ActiveWidgets)
June 29,
aah that might be the problem, thanks Alex. I see that in the aw.css there is an entry .aw-toggle-checkbox .aw-item-marker {background-image:url(checkbox1.png)} and
.aw-ui-checkedlist .aw-toggle-checkbox .aw-item-marker {background-image:url(checkbox2.png)}
Do i need to add checkbox1.png and checkbox2.png. These images dont look like the right ones. i still tried and the checkbox didnt show up.

Thanks
IS
June 29,
Got it working.
Thanks a ton Alex. Now one last question to save the day. Is there a way to have checkboxes in alternate rows and not have the user to press the control key if he needs to multi select?

Greatly appriciate your responses.
IS
June 29,
Alex - as an alternative to the above is it possible to have checkboxes on select rows in the selector. I know we can do that for all rows using grid.setSelectorTemplate(new AW.Templates.CheckedItem); , but can we apply it to select rows.

Thanks
IS
June 29,
You can hide checkboxes in odd/even rows using the combination of .aw-alternate-odd and .aw-item-marker selectors, for example

.aw-alternate-odd .aw-item-marker {display: none}

or

.aw-alternate-odd .aw-item-marker {visibility: hidden}

You can also add column index and/or grid id# selectors if necessary -

#myGrid .aw-alternate-odd .aw-column-0 .aw-item-marker {display: none}


It is also possible to assign checkbox template to a particular row(s) -

grid.setSelectorTemplate(new AW.Templates.CheckedItem, 0);

Alex (ActiveWidgets)
June 29,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.