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.
Printable View
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.
Hi @aditya,
So, is the Edit event not suitable for you?
thanks daniil,
edit event is not suitable for me because in my code
you can see.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">
i want,
when click over column10, i want to set value of column8 using java script.
OK, here is an example.
Example
Code:<%@ 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>
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.
Can you please tell how to fire the Event in EXT.NET MVC Razor view ??
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
As above i want to write this in EXT.NET MVC in razor??Code:<CustomConfig>
<ext:ConfigItem Name="click" Value="onRatingColumnClick" Mode="Raw" />
</CustomConfig>
I tried this but this didnt work for meCode:.CustomConfig {
new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw)
}
It should look like this.
Code: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
Attachment 7761Code:Html.X().RatingColumn()
.Listeners(events =>
events.CustomConfig.Add(new ConfigItem("click", "onRatingColumnClick", ParameterMode.Raw))
)
.CustomConfig(cc =>
cc.Add(new ConfigItem("clickable", "true", ParameterMode.Raw))
)