Can anyone tell me, how to set the readonly property to a TextItem in SmartGwt??
Thanks & Regards,
Kothandaraman N.
Thanks & Regards,
Kothandaraman N.
... readOnly(textItem.getName()); ... private static native void readOnly(String objectName) /*-{ if (objectName == null) { return; } if ($wnd.document.getElementsByName(objectName) == null) { return; } var textField = $wnd.document.getElementsByName(objectName)[0]; textField.setAttribute("readOnly","true"); }-*/;
private static ArrayList<String> fieldNames = new ArrayList<String>(); private static Timer setReadOnlyTimer = new Timer() { @Override public void run() { for (String fieldName : fieldNames) { try { readOnly(fieldName); } catch (Exception exc) { exc.printStackTrace(); } } fieldNames.clear(); } }; public static void setAsReadOnly(String fieldName) { fieldNames.add(fieldName); setReadOnlyTimer.schedule(500); }
setAsReadOnly(String fieldName)
... readOnly(textItem.getName()); ... private static native void readOnly(String objectName) /*-{ if (objectName == null) { return; } if ($wnd.document.getElementsByName(objectName) == null) { return; } var textField = $wnd.document.getElementsByName(objectName)[0]; textField.setAttribute("readOnly","true"); }-*/;
private static ArrayList<String> fieldNames = new ArrayList<String>(); private static Timer setReadOnlyTimer = new Timer() { @Override public void run() { for (String fieldName : fieldNames) { try { readOnly(fieldName); } catch (Exception exc) { exc.printStackTrace(); } } fieldNames.clear(); } }; public static void setAsReadOnly(String fieldName) { fieldNames.add(fieldName); setReadOnlyTimer.schedule(500); }
setAsReadOnly(String fieldName)
TextItemObject.setTextBoxStyle("read-only: true;");
TextItemObject.setCellStyle("read-only: true;");
textitem.setAttribute("readOnly",true);
Comment