[CLOSED] Mark template column as dirty

  1. #1

    [CLOSED] Mark template column as dirty

    I have a standard grid. When I want to set a cell to be dirty, I get the record and then call:
    record.set("columnToUpdate", "Text");
    this automatically updates the grid and flags it as "dirty"

    however, if I am using a TemplateColumn, it doesn't show the red dirty hash mark. I know that it is either Renderer or TemplateColumn but I assumed this would work.

    How can I make the red hash show dirty on TemplateColumn? I am not able to set it via renderer? need to do it in JS

    Thanks,
    /Z
    Last edited by Daniil; Jun 16, 2014 at 3:49 AM. Reason: [CLOSED]
  2. #2
    Hi @Z,

    The problem is that a TemplateColumn doesn't use a DataIndex and its Template might be quite arbitrary. So, I don't think there is a good way to track a dirty status.

    Please post the TemplateColumn's configuration. I will think what to do.
  3. #3
    See below
    /Z
                    <ext:TemplateColumn ColumnID="aaa" Header="aaa" Width="200" Editable="false" Locked="true" >
                        <Template ID="Template1" runat="server"> 
                            <Html>
                                <a href="javascript:changeStuff());"><img style="cursor:pointer;width:16px;height:16px;" src="/resources/images/32x32/icon.png" /></a> {aaa} 
                            </Html>
                        </Template>
                    </ext:TemplateColumn>
  4. #4
    What about a Column's Renderer for that instead of a TemplateColumn? Then you probably get rid of the problem with a dirty flag.
  5. #5
    Maybe. Let me try the renderer now. What about this for a template solution?

    I will add this to the Html of the TemplateColumn. Then I can parameterize the &nbsp; with a {isDirty} value. Then I just set the record.set('isDirty', '&nbsp') and it will show. By default, it is blank so it doesn't.

    <div class="x-grid3-dirty-cell" style="position:relative;top:-3px; left:-5px;height:5px; max-height:5px;z-index: 10;">&nbsp;</div>
  6. #6
    I just re-wrote it as a renderer and it worked fine. a little ugly on the JS side (lets of concatenation) but I just built 5 strings, joined them and it works great now.

    on a side note, the template trick works also to show dirty but it is not as clean a solution.

    Thanks,
    /Z
  7. #7
    Well, probably there is a workaround to get it working. Maybe, your approach will work well for you.

    Though, with a Column's Renderer you should not have any problems at all.
  8. #8
    Quote Originally Posted by Z View Post
    a little ugly on the JS side (lets of concatenation)
    You could use String.format().
    String.format("Hello {0}! I am {1}.", "@Z", "Daniil");
  9. #9
    thxs. pls close

Similar Threads

  1. [CLOSED] Column template and renderer
    By marco.morreale in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 03, 2013, 3:12 PM
  2. [CLOSED] Format number in gridpanel template column
    By asiaesolutions in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jan 14, 2013, 8:28 AM
  3. [CLOSED] Mark a FormPanel as no longer dirty?
    By dmoore in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 23, 2012, 7:57 PM
  4. Custom Template Column
    By QualityCode in forum 1.x Help
    Replies: 2
    Last Post: Oct 29, 2011, 11:18 PM
  5. [CLOSED] Is there any function for formpanel to mark dirty record.
    By xian.xu in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Aug 26, 2011, 8:38 AM

Posting Permissions