EasyUI Forum
May 08, 2024, 12:42:43 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to import json data into datagrid in the memory  (Read 6235 times)
dustinjo
Newbie
*
Posts: 3


View Profile
« on: February 24, 2014, 08:53:10 PM »

I'm not sure if here is the correct place for my question.
I would like to purchase the license of a product, and I need to know if it is possible for my project.

1. Is it possible to import the json data into datagrid in the memory?
2. How do I retrieve data in the datagrid by button click event instead of having it appear automatically?
3. How do I use file upload process?

Thank you.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: February 24, 2014, 11:58:45 PM »

1. Set the 'data' property to load local data or 'url' property to load remote data.
Code:
$('#dg').datagrid({data:...});  // load local data
$('#dg').datagrid({url:...});   // load remote data
2. Call 'getData' or 'getRows' methods to return the data bound to datagrid.
Code:
var data = $('#dg').datagrid('getData');
console.log(data);
var rows = $('#dg').datagrid('getRows');
console.log(rows);
3. To upload a file, declare a form with enctype set to 'multipart/form-data' and then call 'submit' method of form to upload the file.
Code:
<form id="fm" action="..." enctype="multipart/form-data" method="post">
  <input type="file" name="file">
  <input type="button" onclick="javascript:$('#fm').form('submit')">upload</input>
</form>
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!