EasyUI Forum
October 18, 2025, 06:40:59 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: onClickRow to generate a side panel form  (Read 12829 times)
wolfnbasti
Newbie
*
Posts: 16


View Profile
« on: July 14, 2014, 02:52:56 PM »

Hello - I'm trying to click a name from a row in single column datagrid, located on the left side of my site, and then have it generate a form on the right side that loads several data items regarding the name clicked. The idea is to list all the account information about the name selected on the right side of the grid column. I can load and populate the data from the DB and display it and design the form, etc.,  but I just can't seem to get the form to appear when the name is clicked from the column.

Any ideas how I might do this? Do I need to move outside of onClickRow to generate the form?

Thanks.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: July 14, 2014, 03:35:30 PM »

How do you generate form code when click a datagrid row. You may need to show some code to demonstrate your issue.
Logged
wolfnbasti
Newbie
*
Posts: 16


View Profile
« Reply #2 on: July 14, 2014, 04:17:34 PM »

I'm not sure I understand what you are asking.

This is how I'm capturing data from my db based on a row click:

var attributeDefs;
var resourceDef;
var resources;
var attributeValues;
var attributeIds;

    $(function(){
      $('#RN').datagrid({
         onClickRow: function(index,row){
            editIndex = index;
            rowEdit = JSON.parse(JSON.stringify($('#RN').datagrid('getRows',editIndex)));
            var editResourceName =  rowEdit[editIndex].resourceName;
            var editResourceId =  rowEdit[editIndex].resourceId;

         $.ajax({
            url: baseUrl + '/clients/' .... /attributes',
            type: "GET",
         }).done(function(data) {
            attributeDefs = data.attributeDefs;
            resourceDef = data.resourceDef;
            resources = data.resources;
            attributeValues = data.attributes.values;
            attributeIds = data.attributes.ids;   
window.alert("resourceDef: " + resourceDef + " attributeValues: " + attributeValues);               
            });
         }
      });
   });

I was thinking there might be some way to use "Load Form Data" ( SEE: http://www.jeasyui.com/demo/main/index.php?plugin=Form&theme=default&dir=ltr&pitem= ) to populate a form when a user clicks a row in the grid. But I haven't had any luck.
Logged
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #3 on: July 14, 2014, 05:07:13 PM »

Suppose that you have a form in your page.
Code:
<form id="ff" ...>
...
</form>
When click a datagrid row, populate some data to the form. The code may look like this:
Code:
$('#RN').datagrid({
onClickRow:function(index,row){
var resourceName = row.resourceName;
var resourceId = row.resourceId;
var url = ... // the url to retrieve the form data
$('#ff').form('load',url);
}
});
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!