Jul 10, 2012, 9:33 AM
Hide an Icon in a GridPanel based on data in the table
Hi,
I've just started working with ext.net and I'm having some issues.
I have the gridpanel being populated with data from a database. But I want to show/hide a "New" icon in each row depending if that data is new in the database (if the column "OPENED_DATE" is within the last 7 days for example).
At the moment I have the Icon.NewRed being shown in every row but am trying to get this for just the new rows. Heres what I have:
When I try and run this I get an error at this line in the javascript:
What am I missing? Why doesn't record support the get method?
I've just started working with ext.net and I'm having some issues.
I have the gridpanel being populated with data from a database. But I want to show/hide a "New" icon in each row depending if that data is new in the database (if the column "OPENED_DATE" is within the last 7 days for example).
At the moment I have the Icon.NewRed being shown in every row but am trying to get this for just the new rows. Heres what I have:
ImageCommand imgCom2 = new ImageCommand();
imgCom2.Icon = Icon.NewRed;
imgCom2.CommandName = "New";
clmn.Commands.Add(imgCom2);
var hideNew = function (command, record) {
var openedDate = record.get('OPENED_DATE');
var newDate = new Date("02/07/2012");
if (openedDate < newDate) {
command.hidden = true;
}
}
<ext:Column ColumnID="PRB_NUMBER" Header="PRB_NUMBER">
<Commands>
<ext:ImageCommand Icon="NewRed" CommandName="New">
</ext:ImageCommand>
</Commands>
<PrepareCommand Fn="hideNew" />
</ext:Column>
PRB_NUMBER is the name of the column that the NewRed icon is located.When I try and run this I get an error at this line in the javascript:
var openedDate = record.get('OPENED_DATE');
saying "Object doesn't support this property or method"What am I missing? Why doesn't record support the get method?