PDA

View Full Version : password field in editor grid



raj_plays
28 Dec 2009, 12:11 AM
Hi,
I have a GridPanel with editor. It shows and allows editing of user fields, which among other columns contains 'password'.
Now, this field has to be mandatory for a new record but not so while updating a record.
If i set allowBlank: true, my purpose is not solved.

Can anyone please suggest a solution

Condor
28 Dec 2009, 1:32 AM
Invalid data in EditorGridPanel editors is ignored/reverted.

I recommend using a RowEditor if you want visual validation errors.

raj_plays
28 Dec 2009, 3:26 AM
Thanks, Condor.
I will ask another question the answer to which will solve my original problem.
In my GridPanel with plugin editor, when i display passwords, they are shown as cleartext.
When i double click it, then it gets masked and becomes editable.
How can I make the password column masked when they are displayed in step 1 above?
Here is the password column in the column model

{header: "Password", width: 180, dataIndex: 'password', sortable: true, value: '', editor: new Ext.form.TextField({ // rules about editing
inputType: 'password',
allowBlank: false,
maxLength: 20,
maskRe: /([[email protected]#$]+)$/ // alphanumeric + spaces allowed
}), align: 'left'
}

Condor
28 Dec 2009, 3:32 AM
inputType:'password' only applies to the editor. When the column isn't edited it just shows the content of the field (which contains the plain-text password).

If you want to show *** when the column isn't edited then you should write a column renderer.

raj_plays
29 Dec 2009, 2:26 AM
Thanks, Condor.

1 more question.

Is it possible to make some columns of a GridPanel Editor readOnly based on a certain condition?
Out of 5 columns, I need 2 read only and the rest editable when a certain condition is true. Other times, all 5 have to be editable.

Regards,
raj_plays

umarkashmiri
29 Dec 2009, 2:33 AM
Thanks, Condor.

1 more question.

Is it possible to make some columns of a GridPanel Editor readOnly based on a certain condition?
Out of 5 columns, I need 2 read only and the rest editable when a certain condition is true. Other times, all 5 have to be editable.

Regards,
raj_plays


Yes offcourse, just set the property of the column readonly:true

Condor
29 Dec 2009, 3:56 AM
Write an isCellEditable method for the ColumnModel that returns false when the field shouldn't be editable.

raj_plays
29 Dec 2009, 6:29 AM
Thanks guys!

Condor's method fits the bill.