How do I bind parameters in a imageCommandColumn to a datastore?

  1. #1

    How do I bind parameters in a imageCommandColumn to a datastore?

    I have a datagrid with a imageCommandColumn however the the image, command and tooltip are dependent on the data type for the row. I have created extra fields in my data store to handle the imageCls, text and tooltip-text properties but I am struggling to find a way to bind these values into the column.

    Is this possible.

    suedo code example
    <ext:gridpanel hideborders="true" 
    id="grdDataView" 
    runat="server" 
    title="Data View"
    striperows="true"
    columnlines="true"
    >
    <store>
    <ext:Store runat="server" id="strData">
    <Reader>
    <ext:JsonReader>
    <Fields> 
    <ext:RecordField Name="StatusCommand" type="String"></ext:RecordField>
    <ext:RecordField Name="StatusIcon" type="String"></ext:RecordField>
    <ext:RecordField Name="StatusClass" type="String"></ext:RecordField> 
    </Fields>
    </ext:JsonReader>
    </Reader>
    </ext:Store>
    </store>
    <columnmodel>
    <Columns>
    <ext:ImageCommandColumn ColumnID="StatusCommand">
    <Commands>
    <ext:ImageCommand IconCls="{StatusClass}" Text="{StatusText}"
    CommandName="{StatusCommand}"></ext:ImageCommand>
    </Commands>
    </ext:ImageCommandColumn> 
    </Columns>
    </columnmodel> 
    </ext:gridpanel>

  2. #2

    RE: How do I bind parameters in a imageCommandColumn to a datastore?

    Hi,

    You have to use PrepareCommand property
    https://examples1.ext.net/#/GridPanel/Commands/Image_Command/


    function prepareCommand(grid, command, record, row) {
    	command.text = record.get('StatusText');
    	command.iconCls = record.get('StatusIcon');
    	command.qtext = record.get('StatusTooltip');
    }

    Command structure:
    command = {
    command,
    cls,
    iconCls,
    hidden,
    text,
    style,
    qtext,
    qtitle,
    hideMode,
    rightAlign
    };
  3. #3

    RE: How do I bind parameters in a imageCommandColumn to a datastore?

    Thanks for the example. Something strange is happening with the tooltips. The icon is not centrally aligned (I specified this in the ext:ImageCommandColumn attribute) and the active area for the tooltip is to the left of the icon and text rather than over it.

    Regards,
    Sean.


    <ext:ImageCommandColumn ColumnID="StatusIcon" header="Status" align="center">
    <Commands>
    <ext:ImageCommand></ext:ImageCommand>
    </Commands>
    
    </ext:ImageCommandColumn>
  4. #4

    RE: How do I bind parameters in a imageCommandColumn to a datastore?

    Hi,

    ImageCommand doesn't support center align, only left or right aligning. Position of the tooltip calculates automatically depeends on current element position. Please provide screenshot which demonstrates the tooltip issue (test sample will be good for us also)
  5. #5

    RE: How do I bind parameters in a imageCommandColumn to a datastore?

    Tooltip issue solved,
    the command object that is pushed onto the commands requires a tooltip object ratherthan the qtext parameter.

    i.e.

    commands.push(
        {
            command : "ChangeStatus",
            iconCls: record.data.StatusIconClass,
            tooltip: {text : record.data.StatusIconTooltip}
        });

Similar Threads

  1. [CLOSED] ImageCommandColumn
    By cwolcott in forum 2.x Legacy Premium Help
    Replies: 5
    Last Post: Jun 15, 2012, 7:44 PM
  2. [1.0] DataStore Record Field Bug
    By protactinium in forum 1.x Help
    Replies: 1
    Last Post: May 17, 2010, 7:07 PM
  3. ImageCommandColumn
    By gisxiaowei in forum 1.x Help
    Replies: 3
    Last Post: Aug 26, 2009, 4:46 PM
  4. [CLOSED] ID for new DataStore Record
    By Steve in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: May 14, 2009, 1:57 PM
  5. [CLOSED] ImageCommandColumn bug
    By alexp in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Mar 03, 2009, 11:15 AM

Posting Permissions