Grid - Retrieving UserData server side

Hello,

I am using Grid with dataProcessor and trying pass additional data to the php connector. I have used the following:

[code]

mygrid.setUserData(“”,“checked”,group_id);
[/code]

So the value in group_id is being sent to the server, however I want to know what the best way to retrieve this value is. I have tried just using the following with no luck:

 [code]

$group_id = $action->get_value(“checked”);
[/code]

So I then used the following which worked:

[code] $ids = explode(“,”,$_POST[“ids”]);
$rowId = $ids[0]; //id or row which was updated
$group_id = $_POST[$rowId.“_checked”];

		$action->set_value("groupId",$group_id);[/code]

The problem now is that the other values that are passed to connector no longer correspond to their named values. I was using the names to retrieve values from fields but they no longer seem to correspond to their correct field. So for example: _c0 should correspond to ‘stats’, but now ‘gr_id’ seems to correspond to ‘stats’.

Is there a better way I should be doing this?

Thank you always for your help. Let me know if you require further clarification.

Which version of grid and connector lib you are using?
In case of grid 2.6 - both row-specific and global user data must be available through

$group_id = $action->get_value("checked");

If problem occurs for the latest version of code - can you provide the server side log for saving operation, where get_value doesn’t work as expected.

Hi Stansilav,

I’m actually using grid within scheduler. So I’m just using the connector within dhtmlxscheduler.js. I am using both latest copies of Grid (2.6) and Scheduler (2.3).

I’ll test this again and post the results. Thanks.

Hello,

Please see the below log from the server side:

[code]

Log started, 23/11/2010 12:11:49

DataProcessor object initialized
1290474828833_gr_id => 1290474828833
1290474828833_c0 => 1
1290474828833_c1 =>
1290474828833_c2 =>
1290474828833_c3 =>
1290474828833_c4 =>
1290474828833_!nativeeditor_status => inserted
1290474828833_checked => 1290474823645
1290474828965_gr_id => 1290474828965
1290474828965_c0 => 2
1290474828965_c1 =>
1290474828965_c2 =>
1290474828965_c3 =>
1290474828965_c4 =>
1290474828965_!nativeeditor_status => inserted
1290474828965_checked => 1290474823645
ids => 1290474828833,1290474828965

Row data [1290474828833]
stats_uid => 1290474828833
set => 1290474823645
stat_da =>
stat_ca =>
stat_order =>
stat_gid =>
!nativeeditor_status => inserted

Incorrect field name used: checked

data
stats_uid => 1290474828833
set => 1290474823645
stat_da =>
stat_ca =>
stat_order =>
stat_gid =>
!nativeeditor_status => inserted

change value of: stat_order as: 1290474823645

change value of: stat_gid as:

INSERT INTO ex_stats(set,stat_da,stat_ca,stat_order,stat_gid) VALUES (‘1290474823645’,’’,’’,‘1290474823645’,’’)[/code]

I’m using a combination of components and have attached the following - all latest versions:

<script src="codebase/dhtmlxscheduler.js" type="text/javascript" charset="utf-8"></script> <script src="codebase/locale.js" type="text/javascript" charset="utf-8"></script> <script src="codebase/dhtmlxcommon.js"></script> <script src="codebase/dhtmlxtabbar.js" type="text/javascript"></script> <script src="codebase/dhtmlxdataview.js" type="text/javascript"></script> <script src="codebase/dhtmlxgrid.js"></script> <script src="codebase/dhtmlxgridcell.js"></script>

I have found a possible reason of problem, as fast solution - please try to use the different name for the userdata field. For example “flagChecked” instead of “checked”

Fixed php file is attached, you can use it instead of the original one.
grid_connector.zip (2.36 KB)

Thank you Stanislav,

As per usual, your fix works perfectly. Should I have not been using ‘checked’ as the name?

The problem was in logic , which separates columns data ( which has names as “cN” ) and column’s data. With old version of code “checked” was processed as column’s data. Updated code will work correctly with any names of userdata.