StrataFrame Forum

Can't add new record to Janus grid

http://forum.strataframe.net/Topic31233.aspx

By Kingsley Price - 6/6/2012

I'm using typical BusinessBindingSource techniques to bind to Janus GridEX (3.5) control, all works well except when adding new records. The new values disappear from the grid when you move to the next row and you receive Null key value error when trying to save.  I have tested BO/BBS with DataGridView and it works fine.

Janus support suggests that ..."if you implement AddItem method in the IBindingList interface, it will add the records without the need of handling the GetNewRecord event" GetNewRecord  is a grid event to handle manually adding a new row to a collection or when implementing IList interface.

Seeing BBS implements IBindingListView I thought that AddItem would be handled.

Anyone had this problem, any ideas?
By Trent L. Taylor - 6/6/2012

I have never tried the Janus grid before, but it should work.  If the standard DataGridView works, then there is probably something else happening on the Janus side.  The DevExpress and Infragistics grids are used in vast numbers with the SF BBS, so I doubt that there is anything that should be changed.  I also know that the SF BBS works with the Telerik grids as I have recently tried that out.

Do you have a stack trace coming back?
By Kingsley Price - 6/6/2012

Thanks Trent. Trace (attached) is from GridEx AddingRecord event, after which entered data disappears and a blank row is left in the Grid. I can send sample project if you wish.

Also got this (clue maybe) of a DevEx forum "...With GridEX (janus), when you add a new row, there is no need to add a new row/record to the datasource first. You can put values in the column and once they are completed/validated, it is only at that point that a new row/object is requested. GridEX then SETs all of the values and the new row/record is then added to the data source..."


update: just discoverd that the newly added grid row is being overridden by the BO's default values. Initially I had them = nothing, now have I have given them values I can see this happening. So it looks like an event timing issue? 
By Kingsley Price - 6/11/2012

Trent, I have received this reply from Janus support team, is there any validity in what they are saying?

... "YourBusinessBindingSource does implement IBindingList but it doesn't implement allthe methods of the interface. In particular, the method that is not implementedcorrectly and the one that I think is causing the problem is IList.IndexOf.When the control uses IndexOf method in your BindingSource after adding theitem using AddNew, the method returns -1 while it should return 0 (when it isthe first item added or, the actual index of the item).

Try to implementthis method especially and the other methods in the IList interface and it shouldwork."...

 

 

By Kingsley Price - 7/6/2012

Any suggestions or feedback ?

As a work around, do I need to sub-class the BBS and try to implement IList.IndexOf as suggested by janus guys?