DataGridColumn editable false?
how to dinamically make editable false for datagridColumn ?
my code is like that
<mx:DataGridColumn
dataField="dispatch"
headerText="Dispatch"
resizable="false"
sortable="false"
editorDataField="selected"
rendererIsEditor="true"
itemRenderer="mx.controls.CheckBox"
>
</mx:DataGridColumn>
when I always try to set editable false for column.but it never became as I need.Any Ideas?
here is the sample
<?xml version="1.0" encoding="utf-8"?>
<!--Project :UserLevel~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!--File :TestGrid.mxml~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!--Date :Mar 24, 2011~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!--Author :Administrator~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var acDao:ArrayCollection=new ArrayCollection();
protected function button1_clickHandler(event:MouseEvent):void
acDao.addItem({col1:1,col2:2,col3:true});
acDao.addItem({col1:11,col2:22,col3:false});
acDao.addItem({col1:12,col2:23,col3:true});
acDao.addItem({col1:13,col2:24,col3:false});
protected function button2_clickHandler(event:MouseEvent):void
for each(var temp:Object in dgDao.dataProvider as ArrayCollection)
trace("first :"+temp["col1"]+"second :"+temp["col2"]+"third :"+temp["col3"]);
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<!--Visual Components Here~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<mx:DataGrid x="300" y="194" id="dgDao" dataProvider="{acDao}" editable="true">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
<mx:DataGridColumn headerText="CheckBox" dataField="col3" editable="true" itemRenderer="mx.controls.CheckBox" editorDataField="selected" rendererIsEditor="true"/>
</mx:columns>
</mx:DataGrid>
<s:Button x="300" y="150" label="Load" click="button1_clickHandler(event)"/>
<s:Button x="383" y="150" label="view" click="button2_clickHandler(event)"/>
</s:Application>
How can I make the checkbox column editable false dinamically?
Similar Messages
-
Set DataGridColumn editable based on row data
I searched for this but did not find a direct answer. People wanted something similar but not exactly the same.
I have several columns in a standard datagrid that I would like to set editable if the data.company_id > 0. Is this possible? Here's my MXML code:
<mx:DataGridColumn headerText="Part Number"
dataField="part_number"
editable="false"
itemRenderer="controls.setTextColor"/>
I tried:
<mx:DataGridColumn headerText="Part Number"
dataField="part_number"
editable="{data.company_id > 0 ? true : false;}"
itemRenderer="controls.setTextColor"/>
But of course that would be too easy, right?
Help greatly appreciated...
RickBut of course that would be too easy, right?
aha, you're in luck
Very quick and rough, but it works like a charm
XML (written from php)
<?php
echo
<thing>
<edit>true</edit>
<value>10</value>
</thing>
<thing>
<edit>false</edit>
<value>1000</value>
</thing>
<thing>
<edit>false</edit>
<value>550</value>
</thing>
<thing>
<edit>true</edit>
<value>20</value>
</thing>
?>
Flex
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="stuff.send()">
<mx:HTTPService id="stuff" showBusyCursor="true" method="POST" url="http://localhost/stuff.php"/>
<mx:DataGrid id="blah" x="240" y="93" dataProvider="{stuff.lastResult.thing}" editable="{blah.selectedItem.edit}">
<mx:columns>
<mx:DataGridColumn dataField="value" editable="{data.edit}"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
so yeah, i'd assume you'd have to edit the actually datagrid editable properties, rather than just the datagrid column. If your function doesn't work in there then just feed it a direct boolean value like i did. -
DataGrid editable="false" but I can type in
Here is my dataGrid:
<mx:DataGrid
id="documents" fontSize="12" rowCount="3" rowHeight="50"width="
100%" editable="false">
and here is a column:
<mx:DataGridColumn
headerText="Document Description"dataField="
docdescript" wordWrap="true">
<mx:itemRenderer>
<fx:Component>
<mx:TextArea>
</mx:TextArea>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
But I can type into that column, why? What am I missing?
ThanksDataGrid editable property is for whether we popup and editor and try to save changes when you change cells. It isn't going to prevent you from putting editable controls in as a renderer and defeat the ability to use the editability of that control. Imagine if the renderer was a complex thing with a checkbox. How would we detect that and prevent clicking it?
So, don't use TextArea. It is heavy and slow. The DG's default renderer can show multiple lines of text anyway.
Alex Harui
Flex SDK Developer
Adobe Systems Inc.
Blog: http://blogs.adobe.com/aharui -
How to make table as "editable false"
Dear Forum,
i am user of jDeveloper jClient/Swing .jpr.
cutomer table having following attributes-
1.cust_id (primary key)
2.cust_name
3.cust_add
Suppose customerview bind with jTable1.
Using ViewObjectEditor, i set "updateable never" for all fields.
This show error, when data insert into table " cust_id as
read only".
Help me, Using jClient Binding how to make Table as "editable false".Overriding method prepareEditor() for new table:
private JTable tableList = new JTable(){
public Component prepareEditor(TableCellEditor editor, int row, int column) {
// 1 and 2 column is not editable
if(column == 0 || column == 1){ return null; }
return super.prepareEditor(editor, row, column); -
dear all
i had set editable fasle to one matrix coloum but now i need to set ti true
but in the screen painter i set it to true but still at the run time it wont work
still i cant edit the value in that coloum.....
is there another way to remove the editable false?
thanks in advaneceHi
Dim Mat As SAPbouiCOM.Matrix = oForm.Items.Item("MatrixName").Specific
Dim column As SAPbouiCOM.Column = Mat.Columns.Item("columnName")
column.Editable =True
Write this code in your after from load event
Hope this will help
Regards
Vivek -
Making Cell of matrix editable =false
oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE;
hi
Dim om As SAPbouiCOM.Matrix
om = Me.m_SBO_Form.Items.Item(enControlName.mtxDetails).Specific
om.Columns.Item(enControlName.colItemCode).Editable = False
regards -
Fuego.workspace.views.editable = false does not work
Hi all,
I have disabled the option for the user to edit the views in the workspace.. using the property
fuego.workspace.views.editable = false
inside of workspace.properties..
I did the above in both the portal workspace.properties file and the ALBPM workspace.properties file.. But as a user, when I login , I still am able to edit and modify the views..
How is this possible?
How can I eliminate this problem?
My project is deployed via. the weblogic portal...
I do not want to change the viewEdit.xhtml file inside of the portal to not to show the edit button to the user..chang75 wrote:
I have created the simple application below. A JFrame with a single button. When the button is clicked the line
jButton1.setEnabled(false);
should disable the button.
The button does get shaded out but continues to work with the System.out.println("Mouse Pressed"); line still printing the message to the screen when the button is pressed.
Please tell me why this happens?That frustrated me as well when I first discovered it. A disabled component should not respond to mouse clicks, should it?
In Windows XP, right-click My Computer and select Properties. That dialog has a disabled Apply button that you can right-click to get a "What's This" menu. Disabled buttons must respond to mouse clicks in order for developers to implement behavior like this.
As suggested previously, use ActionListener instead of MouseListener for JButton clicks. -
Editable(false) on a column in a JTable. how to?
how can I set a column named Total, in a JTable to not be editable?
thanks
ameal from sv�rjeHai Ameel,
check the following thread,
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=704416
Hope this helps,
Regards,
Ciya. -
JTextField's - setting editable false, but without greying out the area?
Is this at all possible? Is there any other way to go about it? Or is the only way to make a textfeild un-edditable using the setEditable(false); command.. and sticking it with the grey area?
Sorry for the weird/dumb/annoying question..
Thanks anyway heh..all i wanted was an answer and this dude just flames
me.I think your need to adjust your sensitivity downward by an order of magnitude. I didn't see anything in Joachim's response that remotely resembled a flame. He simply pointed out that your requested goal violates standard usability principles (rather politely, I might add). You referred to your own question in a more derogatory manner than any respondent.
Personally, I think his advice was very helpful. You shouldn't violate standard usability principles unless you're just deliberately trying to confuse your users, which is not something many of us would care to give advice on how to do... -
Awt.TextArea: does it have to be gray when editable(false) ?
I want to have some text scroll from the bottom to the
top of an applet.
I think it would be a good solution to put the text in
a TextArea, and move the caretPosition. (or simular).
The problem is that when I use setEnabled(false) ,
the colors og the component emediatly changes to it's
original colors.
I know this is not the case with JTextArea, but I would
like to stick with non-swing-components on this one.
Any suggestion ?Thanx. That worked brilliantly!
Now, I've got a minor problem whith teh scrolling.
My applet implements Runnable, and the scrolling is
happening in the run-method.
The thing is...it's not scrolling smoothly. It rather seems
like the longer lines take longer time.
the run-method is like this
public void run() {
while (true) {
sa.setCaretPosition( sa.getCaretPosition() + sa.getColumns() );
try{
tr.sleep(100);
catch( InterruptedException ie ) {
System.out.println("Feil");
} -
Datagridcolumn visible=false acting weird
Hi everybody!
I have problems with a few columns that shows up again when I
do send to the httpService that is the dataProvider to the
datagrid. The stay hidden if I use a repeater, but not when I use
the httpService. I downloaded the hotfix hoping for a solution, but
that didn't not solve it.
Is there a work around, or do I have to wait for next
hotfix?I have experienced several issues with this issue. Although
the latest version addressed most of them, there seems to be
certain instances where it still happens.
Try this.
Create a function like.
public function setHiddenColumns():void {
LastActivityDate.visible = false;
OwnerName.visible = false;
Then call the function on CreationComplete and after your
remote object result.
Also, I have noticed some different results with how your
DataGrid columns are ordered in your code. Try putting a field that
is always visible as the last column. So, make sure you don't have
a hidden column as your last column. It fixed my issue. -
Hi All,
I'm having below code
<mx:Script>
[Bindable]
public var mySourceDataProvider:Array = new Array({isRowSelected: false, name:'Name1', age:10, comment:'Comment1'},
{isRowSelected: false, name:'Name2', age:20, comment:'Comment2'},
{isRowSelected: false, name:'Name3', age:30, comment:'Comment3'},
{isRowSelected: false, name:'Name4', age:40, comment:'Comment4'});
</mx:Script>
<mx:DataGrid id="mySourceDataGrid" dataProvider="{mySourceDataProvider}" headerRelease="headRelEvt(event);" x="54" y="65" width="365">
<mx:columns>
<mx:DataGridColumn sortable="false">
<mx:headerRenderer >
<mx:Component>
<mx:HBox horizontalAlign="center" verticalAlign="middle">
<mx:CheckBox selected="{outerDocument.check_flg}" click="outerDocument.headerCheckBoxSelection(event);"/>
</mx:HBox>
</mx:Component>
</mx:headerRenderer>
<mx:itemRenderer>
<mx:Component>
<mx:VBox horizontalAlign="center" verticalAlign="middle">
<mx:CheckBox id="source"
selected="{data.isRowSelected}"
click="outerDocument.updateSelectedRowFlag(event);"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn dataField="name"/>
<mx:DataGridColumn dataField="age"/>
<mx:DataGridColumn dataField="comment"/>
</mx:columns>
</mx:DataGrid>
The grid is showing correctly with data and it is working fine. Now I need to have hyperlink/linkbutton on name column displayed in DataGrid. When I press this link/button it should navigate to different page(.mxml)...
Can someone please let me know how to do this?
Thanks in advance.
Regards,
sharath.I'm able to solve this problem but having question on setting style on linkbutton. Linkbutton style is not working
<mx:DataGridColumn editable="false" textAlign="center" id="dgCol_buttons" >
<mx:itemRenderer>
<mx:Component>
<mx:LinkButton styleName="htmlLink" label="{data.name}" toolTip="Accept WorkOrder"/>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:Style>
.htmlLink {
fontSize: 12;
fontWeight: normal;
text-decoration:underline;
</mx:Style>
text-decoration is defined as underline but it is not showing underline for linkbutton column.
Can you please advice, how to solve this problem. -
Trying to assign an XML attribute value to a button label
I have a Flex app (developed in FLEX 2) that reads from
multiple XML files and populates datagrids with element values.
What I'm trying to do now, is to create a second column with a
button, enabling users to view archived versions for each current
report.
My problem is: I can't get the <mx:Button> label to
accept the attribute "name". I've tried atleast 10 - 20 different
syntax.
My XML file looks like this:
<metrics>
<report name="test">
<link>test Report 10/28/2008</link>
<url>test-10_28_2008.zip</url>
<status>active</status>
</report>
</metrics>
The mxml looks like this:
<mx:Button buttonMode="true" useHandCursor="true"
click="handleClick()" label="{data.@name}" width="80">
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new
URLRequest([L=http://new.test.com/pages/r_archive_apps/"+data.link+".html");[/L]]http://n ew.test.com/pages/r_archive_apps/"+data.link+".html");[/L][/L]
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:Button>
When I try to label a button with an element it works fine.
Some of the other sytax I've used are:
- label="{data.report.@name}"
- label="{data.report.(@name=='test')}"
- label="{data.report.(@name='test')}"
- label="{data.@name}"
- label="{data.metrics.report.@name}"
- label="{data.metrics.report.(@name=='test')}"
- label="{data.metrics.report.(@name='test')}"quote:
Originally posted by:
rtalton
Can you post some code so we can see how you are using the
button? I think you may be using the button within a datagrid
itemRenderer, which might make a difference.
You're right, the button is in a datagrid itemRenderer. I've
pasted more dataGrid code below - thanks again.
<mx:DataGrid id="dgCatalog" dataProvider="{_xlcCatalog}"
rowCount="4" editable="false" sortableColumns="false"
left="148" top="65" bottom="42" borderStyle="solid"
alternatingItemColors="[#ecf8ff, #ffffff]"
themeColor="#ffff80" alpha="1.0" cornerRadius="0"
dropShadowEnabled="true" dropShadowColor="#000000" width="549"
creationCompleteEffect="{glow3}">
<mx:columns>
<mx:Array>
<mx:DataGridColumn editable="false" headerText="Daily -
Report Names" dataField="link" textAlign="left" width="200">
<mx:itemRenderer>
<mx:Component>
<mx:LinkButton click="handleClick()" label="{data.link}"
>
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new URLRequest("
http://test.new.com/test/"+data.url);
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:LinkButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<mx:DataGridColumn editable="false" headerText="Daily -
Report Archives" dataField="link" textAlign="left" width="80">
<mx:itemRenderer>
<mx:Component>
<mx:Button buttonMode="true" useHandCursor="true"
click="handleClick()" label="{data.report.@name}" width="80">
<mx:Script>
<![CDATA[
public function handleClick():void{
var url:URLRequest = new URLRequest("
http://test.new.com/pages/test_apps/"+data.link+".html");
navigateToURL(url,"_blank");
]]>
</mx:Script>
</mx:Button>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
<!--mx:DataGridColumn headerText="URL" dataField="url"
width="350"/>
<mx:DataGridColumn headerText="Status" dataField="status"
width="70"/-->
</mx:Array>
</mx:columns>
</mx:DataGrid> -
How to get the index for itemrenders
I have an itemrender with a button. I'd like to disable the button for the first and last object in my itemrenderer (list). Can any provide a simple example how to accomplish this task?
Thanks for your assistance.Hi madhooper,
You can try this way..make use of Boolean variable..
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" >
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
private var initDG:ArrayCollection = new ArrayCollection([
{Artist:'Pavement1', Album:'Slanted and Enchanted', Price:11.99, IsEnabled:false},
{Artist:'Pavement2', Album:'Brighten the Corners', Price:178.99, IsEnabled:true},
{Artist:'Pavement3', Album:'Enlighten the Corners', Price:174.99, IsEnabled:true},
{Artist:'Pavement4', Album:'Borade the Corners', Price:431.99, IsEnabled:true},
{Artist:'Pavement5', Album:'Corners of Edges', Price:221.99, IsEnabled:true},
{Artist:'Pavement6', Album:'Maniacal Palace', Price:32.99, IsEnabled:false}
]]>
</mx:Script>
<mx:Panel paddingTop="10" paddingBottom="10"
paddingLeft="10" paddingRight="10">
<mx:DataGrid id="myGrid" dataProvider="{initDG}"
width="100%" editable="true">
<mx:columns>
<mx:DataGridColumn dataField="Artist" resizable="true"/>
<mx:DataGridColumn dataField="Album" resizable="true"/>
<mx:DataGridColumn dataField="Price" resizable="true"/>
<mx:DataGridColumn editable="false">
<mx:itemRenderer>
<mx:Component>
<mx:Button enabled="{data.IsEnabled}" label="Edit" />
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
</mx:columns>
</mx:DataGrid>
</mx:Panel>
</mx:Application>
Thanks,
Bhasker -
Flex DataGrid last empty column dynamic width
Goal: have a blank right-most column in a DataGrid that takes
up the slack in case the other columns do not total 100% of the
overall grid width.
This is what I have, which seems to work:
<mx:DataGridColumn editable="false" sortable="false"
minWidth="0"/>
I am wondering if there is a best-practice way of specifying
such a last column that is better than the above tag.
Flex SDK 3.2
Thank you,
Mike ChabotIt worked!!!!!!! Thank you!! What you mentioned was indeed the problem!
Here is the custom item renderer's set data function
Before
Now
override public function set data(value : Object):void{
super.data = text;
this.txt.text = (value as Slide).text ; //txt is the Label control
override public function set data(value : Object):void{
super.data = value;
this.txt.text = (value as Slide).text ; //txt is the Label control
oh man, this is such a stupid mistake. I think I was confused with having three text properties - one inherited from MXDataGridItemRenderer, one in my txt Label control and one on my slide.
I had no idea that sending the value up to the super class was so important. None of the docs I read seemed to give much importance to this statement.
thanks so much and sorry for taking up so much of your time. I guess it is uncessary to post any more code.
Maybe you are looking for
-
Hello. I'm working on a book and the TOC has the page numbers aligned to the right, via a right indent tab, that I defined on the paragraph styles the TOC uses. Some of the entries, however, are a bit long and so they get too close to the page number
-
Create table rollback in interbase
Hi, I'm using JDBC interbase driver and I'm unable to rollback a createTable statement. I've tried setting the autocommit property to false but it doesn�t seems to work: con.setAutoCommit(false); stmt.executeUpdate("create table name (name varchar(15
-
Security analyst over on F-Secure are reporting a possible OPSEC issue in Yosemite. After copy a file from a Mac to a USB thumb drive, the user discovers that the Spotlight index files , ".store.db", contained e-mail addresses, subject lines, and in
-
TTG HTML Gallery is pretty much what it sounds like: a new HTML gallery for Lightroom. It outputs valid XHTML and CSS, and a lot more customization options than the LR HTML gallery. It boasts thumbnail annotations, ratings, color labels and onImage N
-
Google & Yahoo won't load?!? All other sites will. .Help Please
I have a Macbook 2007 running the latest version of Leopard and updated using Software Update. When I use either Firefox, Opera, or Safari 4 beta I can't bring up Yahoo or Google when I enter their URL in the address bar. Other sites work fine but ju