Forum

July 12th, 2025
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
Custom Checkbox
28/10/2011
19:44
Avatar
Rob
Member
Members
Forum Posts: 4
Member Since:
17/08/2011
sp_UserOfflineSmall Offline

Below is a custom formatter I have for a cell to place two checkboxes in a cell.    

function myFormatter(cellvalue,options,rowObject)
    {
        var regID="";
        if (rowObject[0] == "undefined")
        {
            regID = rowObject.regID    ;
        }
        else
        {
            regID = rowObject[0];
        }
        var approval = $('#grid').getLocalRow(options.rowId).approvalSelect;
        return '<input type="checkbox" id="checkBoxYes_'+options.rowId+'" name="yes"  value="'+ regID +'" ' + (approval=='Yes' ? 'checked="checked"' : '') + 'onclick="myFunctionYes(' + options.rowId + ')" />Yes&nbsp;&nbsp;'+
        '<input type="checkbox" id="checkBoxNo_'+options.rowId+'"  name="no" value="'+ regID +'" ' + (approval=='No' ? 'checked="checked"' : '') + 'onclick="myFunctionNo(' + options.rowId + ')" />No';
    }

I have a button to set all checkboxes to Yes in the grid.  I am looping through all of the records to set the cell value to Yes.  It only seems to set the first page boxes to Yes but no of the other pages have the value checked.  If I manually navigate to say page 2 and press the button then all of the cells are set to Yes.

function setAllToYes()
{
    var count = $('#grid').getGridParam("records");

    for (x=1; x<=count;x++)
    {
        var rowData = $('#grid').getRowData(x).approvalSelect;
        $('#grid').updateGridRows({approvalSelect:'Yes'}, x, false);
        $('#grid').setCell(x,'approvalSelect','Yes');
        $('#checkBoxYes_' + x).attr('checked',true);
        $('#checkBoxNo_' + x).attr('checked',false);
        $('#grid').saveRow(x,false,'clientArray');    
        var rowData1 = $('#grid').getLocalRow(x).approvalSelect;
        alert(x + " : " + rowData + " : " + rowData1);
        
    }

Forum Timezone: Europe/Sofia

Most Users Ever Online: 994

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information