Welcome Guest Search | Active Topics | Sign In | Register

In Grid on new empty row, "Index was out of range" Options
ITMA
Posted: Wednesday, October 6, 2010 4:58:50 AM
Rank: Advanced Member
Groups: Member

Joined: 6/23/2010
Posts: 48
Hi!

I have a Grid and using the excel editing features based upon provided examples. The Grid also has the property “allowadditions” set to true.

- I’ve seen that the “item index value” for a new record is = -1.

- When on server side trying to capture anything that would identify what to execute based on the position in the grid; if the row in fact is a row or just a temporarily row, I’m struggling with the error raised on server side>

Index was out of range. Must be non-negative and less than the size of the collection.

I’ve tried several different things both on client and server side. The problem seems as it is not successful detecting whether it is a row or not. The ItemIndex seems as not immediately reflecting on server side that it was change on the client side.

Really confusing and frustrating. Any input on this is highly appreciated.

___________________________________
My JavaScript function:

function grid_item_command_handler(
grid, itemIndex, colIndex, commandName) {

var grid = eo_GetObject("Grid1");

if (commandName == "Deleting") {
grid.deleteItem(itemIndex);
var xCom2 = commandName
grid.raiseItemCommandEvent(itemIndex, xCom2);
}
if (commandName == "Detail") {

var indexFix = -1
var xCom2 = commandName

if (itemIndex >= 0) {
indexFix = itemIndex
}

if (indexFix < 0) {
xCom2="DetailRun"
}

grid.raiseItemCommandEvent(itemIndex, xCom2);
}
}
___________________________________

Best Regards,
ITMA
eo_support
Posted: Wednesday, October 6, 2010 9:27:18 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I do not believe you can raise any server event on the temp item. The temp item is the last item on the client side in the Grid, but it only exists on the client side. If you leave the temp item, that temp item will become a permanent item and only after that you will be able to access the item on the server side. At the same moment a new temp item is created. So in short, you will never be able to access the temp item on the server side. It does not exist on the server side.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.