Jump to content

Update Grid Cell Clientside


eono

Recommended Posts

Hi,

 

How can I update the value of a particular cell of a row using Javascript on the client and still have the value submitted to the server on grid post?

 

I have tried:

store = frm.dbg.store
r = getAt(0)
r[0] = 'new value'
r.commit() 
// at this point, the data shows in the grid

When I do a save of the grid using the navigators save button, the new data entered, and displayed on the grid, is not saved to the server. Doing a normal data edit on the grid saves any grid changes.

 

What am I missing?

 

Link to comment
Share on other sites

Hi,

 

Maybe like this ?:

var grid = MainForm.UniDBGrid1;
var edPlugin = grid.editingPlugin;

edPlugin.startEditByPosition({
    row: 0,
    column: 1
});
edPlugin.getActiveEditor().field.setValue("newValue");
edPlugin.completeEdit();

Best regards,

  • Like 1
  • Upvote 1
Link to comment
Share on other sites

Hi,

 

Maybe like this ?:

var grid = MainForm.UniDBGrid1;
var edPlugin = grid.editingPlugin;

edPlugin.startEditByPosition({
    row: 0,
    column: 1
});
edPlugin.getActiveEditor().field.setValue("newValue");
edPlugin.completeEdit();

Best regards,

 

Perfect! You the men. Lost some hair trying to get this to work.  :biggrin:  :biggrin:  :biggrin:

  • Like 1
Link to comment
Share on other sites

@DelphiDeveloper,

 

This works, but it still has to contact the server :-(

Can't I have a scenario where the server is not contacted until I click on the save button, when I am done processing?

Link to comment
Share on other sites

This works, but it still has to contact the server :-(

 

Yes, in any case, you need the server side to commit changes

 

 

Can't I have a scenario where the server is not contacted until I click on the save button, when I am done processing?

 

Of course, your changes will not be saved, until you don't commit on the server

 

 

Sorry, maybe I did not quite understand you

But, In any case, the grid needs connect to the server for some synchronization

Link to comment
Share on other sites

Thanks for your prompt replies @delphideveloper

 

I want a situation where it doesn't contact the server until I explicitly want it to. Say I need to process 5 columns for 4 rows, with this I will hit the server 20 times in total. What I want is to hit the server just once, when I am done and I click a button 'Save' on the grid's form.

 

Is there no way to delay the grids synchronization until when saving or manually trigger the synchronization?

 

Kind regards.

Link to comment
Share on other sites

How will you change the data on the grid, all the changes at one "moment"?

Using the code you provided, I can make the changes on the grid clientside. When I am done I can then click a button on the grids form and send all changes made to the grid to the server.

Link to comment
Share on other sites

  • 1 year later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...