[CLOSED] event for RatingColumn?

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] event for RatingColumn?

    can we get click event of Rating Column??
    i refer this link http://forums.ext.net/showthread.php...ghlight=rating
    can any one suggest how to override the processEvent function of given link JS.
    Last edited by Daniil; Nov 20, 2013 at 7:23 AM. Reason: [CLOSED]
  2. #2
    Hi @aditya,

    So, is the Edit event not suitable for you?
  3. #3
    thanks daniil,
    edit event is not suitable for me because in my code
    <ext:RatingColumn ID="Column8" runat="server" Text="Avg." DataIndex="AvgVoteRating" Sortable="False" />
    <ext:Column ID="Column9" runat="server" Text="# Raters" DataIndex="NumberOfVotes" Sortable="False"></ext:Column>
    <ext:RatingColumn ID="Column10" runat="server" Text="You" DataIndex="Rating" RoundToTick="True" Editable="true" Sortable="False">
    you can see.

    i want,
    when click over column10, i want to set value of column8 using java script.
  4. #4
    OK, here is an example.

    Example
    <%@ Page Language="C#" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest)
            {
                Store store = this.GridPanel1.GetStore();
                store.DataSource = new object[] 
                { 
                    new object[] { "test", 3 },
                    new object[] { "test", 4 },
                    new object[] { "test", 5 }
                };
            }
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET v2 Example</title>
    
        <script>
            Ext.net.RatingColumn.override({
                processEvent: function(type, view, cell, recordIndex, cellIndex, e) {
                    var grid, record;
                    if (this.editable && type == 'mousedown') {
                        grid = view.panel,
                        record = grid.store.getAt(recordIndex);     
         
                        if (this.allowChange || !record.isModified(this.dataIndex)) { 
                            var value = (e.getXY()[0] - Ext.fly(e.getTarget()).getX()) / this.tickSize; 
                            if (value < this.zeroSensitivity) { 
                                value = 0 
                            } 
                            if (this.roundToTick) { 
                                value = Math.ceil(value); 
                            } 
    
                            if(value > this.maxRating){
                                value = this.maxRating;
                            }
    
                            var ev = {
                                grid   : grid,
                                record : record,
                                field  : this.dataIndex,
                                value  : record.get(this.dataIndex),
                                row    : view.getNode(recordIndex),
                                column : this,
                                rowIdx : recordIndex,
                                colIdx : cellIndex,
                                cancel : false
                            };
    
                            if (grid.fireEvent("beforeedit", grid, ev) === false || ev.cancel === true) {
                                return;
                            } 
    
                            ev.originalValue = ev.value;
                            ev.value = value;
                
                            if (grid.fireEvent("validateedit", grid, ev) === false || ev.cancel === true) {
                                return;
                            } 
    
                            record.set(this.dataIndex, value); 
    
                            grid.fireEvent('edit', grid, ev);
                            // cancel selection.
                            return false;
                        }             
                    } else if (this.clickable && type == 'mouseup') { // the addition
                        grid = view.panel,
                        record = grid.store.getAt(recordIndex);     
                        this.fireEvent("click", this, record.get(this.dataIndex), record);
                    } else {
                        return this.callParent(arguments);
                    }
                }
            });
        </script>
    
        <script>
            var onRatingColumnClick = function(ratingColumn, value, record) {
                record.set("test", value);
            };
        </script>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            <ext:GridPanel ID="GridPanel1" runat="server">
                <Store>
                    <ext:Store runat="server">
                        <Model>
                            <ext:Model runat="server">
                                <Fields>
                                    <ext:ModelField Name="test" />
                                    <ext:ModelField Name="rating" />
                                </Fields>
                            </ext:Model>
                        </Model>
                    </ext:Store>
                </Store>
                <ColumnModel runat="server">
                    <Columns>
                        <ext:Column runat="server" Text="Test" DataIndex="test" />
                        <ext:RatingColumn runat="server" Text="Rating" DataIndex="rating">
                            <Listeners>
                                <CustomConfig>
                                    <ext:ConfigItem Name="click" Value="onRatingColumnClick" Mode="Raw" />
                                </CustomConfig>
                            </Listeners>
                            <CustomConfig>
                                <ext:ConfigItem Name="clickable" Value="true" Mode="Raw" />
                            </CustomConfig>
                        </ext:RatingColumn>
                    </Columns>
                </ColumnModel>
            </ext:GridPanel>
        </form>
    </body>
    </html>
  5. #5
    Thanks a lot Daniil, your solution works like a charm as always. thanks again..
    i understand now how to override js.

    please set this thread as CLOSED.
  6. #6

    Event for Rating Column

    Can you please tell how to fire the Event in EXT.NET MVC Razor view ??
  7. #7
    Hi @mano1822,

    Welcome to the Ext.NET forums!

    Well, in the same way. Could you provide more details about the problem, please?
  8. #8
    Quote Originally Posted by Daniil View Post
    Hi @mano1822,

    Welcome to the Ext.NET forums!

    Well, in the same way. Could you provide more details about the problem, please?
    In EXT.NET ConfigItem is written as be

    <CustomConfig>
                                    <ext:ConfigItem Name="click" Value="onRatingColumnClick" Mode="Raw" />
                                </CustomConfig>
    As above i want to write this in EXT.NET MVC in razor??

    .CustomConfig { 
                                                                                 new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw)
                                                                             }
    I tried this but this didnt work for me
    Attached Thumbnails Click image for larger version. 

Name:	EXTNET.JPG 
Views:	23 
Size:	12.6 KB 
ID:	7701   Click image for larger version. 

Name:	EXTNETMVC.JPG 
Views:	29 
Size:	11.6 KB 
ID:	7711  
    Last edited by Daniil; Mar 04, 2014 at 1:20 PM. Reason: Please use [CODE] tags
  9. #9
    It should look like this.
    Html.X().RatingColumn()
        .Text("Rating")
        .DataIndex("rating")
        .Listeners(events =>
            events.CustomConfig.Add(new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw))   
        )
        .CustomConfig(cc => 
            cc.Add(new ConfigItem("clickable", "true", ParameterMode.Raw))
        )
  10. #10
    Quote Originally Posted by Daniil View Post
    It should look like this.
    Html.X().RatingColumn()
        .Text("Rating")
        .DataIndex("rating")
        .Listeners(events =>
            events.CustomConfig.Add(new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw))   
        )
        .CustomConfig(cc => 
            cc.Add(new ConfigItem("clickable", "true", ParameterMode.Raw))
        )
    There is no Listeners in RatingColumn(). . . . Can you please check it

    Html.X().RatingColumn()
    
    .Listeners(events =>
                                                                    events.CustomConfig.Add(new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw))   
                                                                )
                                                                .CustomConfig(cc => 
                                                                    cc.Add(new ConfigItem("clickable", "true", ParameterMode.Raw))
                                                                )
    Click image for larger version. 

Name:	EXTNETMVC.JPG 
Views:	26 
Size:	18.5 KB 
ID:	7761
    Last edited by Daniil; Mar 06, 2014 at 11:31 AM. Reason: Please use [CODE] tags
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 6
    Last Post: Apr 30, 2013, 2:44 PM
  2. [CLOSED] RatingColumn and ComponentConfig
    By Svr77 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 08, 2012, 3:08 PM
  3. [CLOSED] event for RatingColumn
    By CarpFisher in forum 2.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 23, 2012, 10:18 AM
  4. Replies: 2
    Last Post: Oct 07, 2011, 4:55 PM
  5. Replies: 2
    Last Post: Oct 07, 2011, 4:54 PM

Tags for this Thread

Posting Permissions