Jump to content


Photo

Update Grid Cell Clientside

grid clientside update cell

  • Please log in to reply
8 replies to this topic

#1 Eldad Onojetah

Eldad Onojetah

    Member

  • uniGUI Subscriber
  • PipPip
  • 33 posts
  • LocationYenagoa, Bayelsa. Nigeria

Posted 12 May 2017 - 09:38 AM

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?

 


  • 0

#2 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3038 posts

Posted 12 May 2017 - 12:12 PM

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,


  • 1

#3 Eldad Onojetah

Eldad Onojetah

    Member

  • uniGUI Subscriber
  • PipPip
  • 33 posts
  • LocationYenagoa, Bayelsa. Nigeria

Posted 12 May 2017 - 01:04 PM

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:


  • 0

#4 Eldad Onojetah

Eldad Onojetah

    Member

  • uniGUI Subscriber
  • PipPip
  • 33 posts
  • LocationYenagoa, Bayelsa. Nigeria

Posted 12 May 2017 - 01:07 PM

@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?


  • 0

#5 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3038 posts

Posted 12 May 2017 - 03:18 PM

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


  • 0

#6 Eldad Onojetah

Eldad Onojetah

    Member

  • uniGUI Subscriber
  • PipPip
  • 33 posts
  • LocationYenagoa, Bayelsa. Nigeria

Posted 12 May 2017 - 03:33 PM

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.


  • 0

#7 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3038 posts

Posted 12 May 2017 - 03:38 PM

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

#8 Delphi Developer

Delphi Developer

    Advanced Member

  • Moderators
  • 3038 posts

Posted 12 May 2017 - 04:11 PM

Ok I will analyze it
  • 0

#9 Eldad Onojetah

Eldad Onojetah

    Member

  • uniGUI Subscriber
  • PipPip
  • 33 posts
  • LocationYenagoa, Bayelsa. Nigeria

Posted 12 May 2017 - 04:40 PM

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.


  • 0





Also tagged with one or more of these keywords: grid, clientside, update, cell

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users