Jump to content

Update Grid Cell Clientside


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 post
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 post
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 post
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 post
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 post
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 post
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 post
Share on other sites
  • 1 year later...
11 minutes ago, eono said:

Hello @Sherzod,

Back to this issue after 2 years!:-)

Hello,

Time goes by so fast...

16 minutes ago, eono said:

Any updates on how to ONLY send the updates when I click a single button?

Please remind the question once again...

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...