EasyUI Forum
May 07, 2024, 08:56:39 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Save to JSON File  (Read 7058 times)
ajhalls
Newbie
*
Posts: 1


View Profile
« on: February 26, 2014, 09:10:27 PM »

Please forgive me for a stupid question. While I was looking at jeasyui it came with some sample data in a json file. When I was using the inline editor feature, it wouldn't save it even with 777 permissions, I checked the access and error logs but there wasn't any entry to indicate it tried and failed.

I am also hoping to use a json file to perhaps drive the configuration of my grid so that on installation it has some default values and works right out of the box, but then I can edit it for mysql connection information options and such in a grid format and save it. Basically I want to setup the config.php type settings by using a grid setup using a tree configuration so you can collapse and expand sections. For very simple usages, they might even be able to get away with only using a json and never connect with mysql (I don’t know, I am not an awesome developer[yet]).

I was trying to combine the Editable Treegrid and the Treegrid with ContextMenu and couldn't find a way to configure a save button for it from the examples. There is a great example for the regular datagrid, but the Treegrid with ContextMenu can't be saved with the code in the example (that I am aware of) to the mysql.
« Last Edit: February 26, 2014, 09:15:38 PM by ajhalls » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 27, 2014, 01:28:23 AM »

When call 'endEdit' method to end a editing row, the row data is only updated in memory, you have to post the updated row to remote server manually. The code below shows how to end editing a treegrid row and save it to the remote server(maybe a mysql database).
Code:
var id = ...  // the node id
$('#tg').treegrid('endEdit', id);
var row = $('#tg').treegrid('find', id);  // find the row data
$.post(yoururl, row, function(result){  // post the row to remote server
  //...
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!