DevExtreme dxDataGrid initNewRow Data always null

Answered
0
0

Hi.

I am implementing a dxDataGrid in an application.
To be able to set row values at a New Row creation, I have changed the Wise.Web.Ext.DevExtreme Extension.
I have added the “initNewRow” Event to the dxDataGrid.cs Constructor and set its data map to the dxDataGrid.js:


		case "initNewRow":
			return {
				data: args.data
			};        

In the application, I attached its Handler and it is being called properly. However, “e.Data” always comes null.
I need to set some default values to the newly created cell as documented here:
https://js.devexpress.com/Documentation/ApiReference/UI_Components/dxDataGrid/Configuration/#onInitNewRow

Is this some sort of special event I should deal with in any different way?

Thanks in advance.

Ivan

  • You must to post comments
Best Answer
0
0

See attached sample.

  • Ivan Borges
    Thank you!
  • mgmst
    • mgmst
    • Jun 3, 2021 - 3:16 pm
    I will try it too :-)
  • You must to post comments
0
0

Hi,

I also need to be able to set default value for newly added row. Would you please, publish solution code for that?

  • You must to post comments
0
0

Hi Luca.

Were you able to get that sample you mentioned earlier?

Cheers.

Ivan

  • You must to post comments
0
0

Hi Luca.

Thank you!!!

I have attached a simple sample which shows a grid and a button to allow to add a New Row.
I have written some comments in the button Click, but basically, after adding the new row to the grid, I would like to set its cells with some default values. I have also added what I had tried and didn’t work.

Attachment
  • You must to post comments
0
0

A browser can send an event (an ajax request) to the server but if the event expects data back it has to be asynchronous. And certainly cannot change a C# object on the server and find  the original javascrip map changed on the client.

The devexpress documentation and sample show a javascript event handler and an async ajax request getting data from an endpoint. You can do the same by adding the javascript code and request data from the wisej widget like it’s shown in our devex data samples using the getPostbackUrl() which automatically wires the request to the Widget’s WebRequest event – where you can return the data just like the devex docs show.

When you use the Wisej automatically wired events you can only send data to the server. Another option you have is to call a server side [WebMethod] from javascript and receive the return value in a callback (last argument) or using a Promise or the await keyword and calling  the {MethodName}Async() version in javascript.

 

 

  • Ivan Borges
    Oh dear… give me a couple of years to get back to you. :-D Thank you Luca, I will digest this and report back.
  • Luca (ITG)
    Attach a small runnable sample showing what you need and we can add sample code for you extend as needed.
  • You must to post comments
Showing 5 results
Your Answer

Please first to submit.