0

Please refer to the jsfiddle : http://jsfiddle.net/jLmm2/3/

{
    key: "CustomeCheckbox",
    label: "<input type='checkbox' id='SelectAll'> Select<br/>All",
    formatter: function (elCell, oRecord, oColumn, oData) {
        if (status == 'on') {
            elCell.innerHTML = '<input type="checkbox" name="TRANSFER" ></input>';
        } else {
            elCell.innerHTML = '<input type="checkbox" name="TRANSFER" disabled="true" ></input>';

        }

    }

I have a custom formatted checkbox : CustomeCheckbox and a standard checkbox : Select in my datatable : container

The issue is CustomeCheckbox, does not remembers the checked state when trying to sort the table.

Can you please help me in this !! Thanks

I have updated the YUI to update the underlying recordset in case checkbox is checked.Standard checkbox is behaving as required, but the custom formatted checkbox is still not retaining the state

    dt.subscribe('checkboxClickEvent', function(oArgs) {
    var elCheckbox = oArgs.target;   
    var elRecord = this.getRecord(elCheckbox); //record of the coloumn 
    var elColumn = this.getColumn(elCheckbox);
    var name = elRecord.getData("Select1");  // Data in that record for the field  
    //alert("Checkbox was " + (elCheckbox.checked ? "" : "un") + "checked for " + name);
    //alert(elCheckbox.checked);
    this.getRecordSet().updateKey(elRecord, elColumn.key, elCheckbox.checked);
});
Chittprakash
  • 67
  • 11

1 Answers1

0

You have to listen to clicks on the checkbox and store the state in the underlying record. The table is drawn out of the record, what doesn't get to the record, it is forgotten.

See how to handle various types of controles here

user32225
  • 854
  • 7
  • 7
  • Can you please show me the updates in jsfiddle.I guess i have tried this example. – Chittprakash Jul 02 '13 at 08:52
  • I have updated the JSFiddle.Since i need few checkbox's disabled.I have to use customeformatter.http://jsfiddle.net/jLmm2/11/.. The checkboxes are still not storing the state.I have tried updating the underlying recordset, still the issue persists. – Chittprakash Jul 02 '13 at 14:06
  • It seems that the checkbox field is called `select` while you are updating a field called `select1` which you are not showing. – user32225 Jul 03 '13 at 10:53
  • var name = elRecord.getData("Select1"); I guess your mentioning about this line.I have commented this one now(http://jsfiddle.net/jLmm2/12/), since this had nothing to do with the updation of underlying recordset.Im updating the recordset as : this.getRecordSet().updateKey(elRecord, elColumn.key, elCheckbox.checked); The checkbox still does not retains it state. – Chittprakash Jul 04 '13 at 03:04