lib-ScrollingTable

27 - Events are lost after changing cols when not setting custom ones

Again, I'm really appreciating this library, makes certain stuff a lot easier. However, when not registering custom events, the default events are lost after changing the cols with SetDisplayCols. So if you would set OnEnter and OnLeave but leave out OnClick, it will do the hovers like normal, but any click events stop working. But if you defined a custom OnClick, this event continues working after changing the cols.

What steps will reproduce the problem?

1. Make a scroll table such a the following;

local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set later on
-- Register custom events
scrollTable:RegisterEvents({
	["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
	["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
});

2. Set new display cols

scrollTable:SetDisplayCols({
	{
		["name"] = "Item",
		["width"] = 100,
	},
	{
		["name"] = "No",
		["width"] = 50,
	},
});

3. Set some same data

scrollTable:SetData({
    { "Sachmo", 12 },
    { "Josua", 8 },
});

4. Click the sort headers.

What is the expected output? What do you see instead?

Continue using the default events.

What version of the product are you using?

r139

Please provide any additional information below.

I have fixed the issue for me for the time being by defining an empty custom OnClick event.

User When Change
Zerotorescue Jan 18, 2011 at 21:57 UTC Changed description:
  Again, I'm really appreciating this library, makes certain stuff a lot easier. However, when not registering custom events, the default events are lost after changing the cols with SetDisplayCols. So if you would set OnEnter and OnLeave but leave out OnClick, it will do the hovers like normal, but any click events stop working. But if you defined a custom OnClick, this event continues working after changing the cols.

  **What steps will reproduce the problem?**
+
  1. Make a scroll table such a the following;
  <<code lua>>
- 			local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set in SetFrameSettings
+ local scrollTable = ScrollingTable:CreateST({}, 4, 15, nil, frame); -- inserting a dummy cols, real cols to be set later on
+ -- Register custom events
- 			scrollTable:RegisterEvents({
+ scrollTable:RegisterEvents({
- 				["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
+ 	["OnEnter"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
- 				["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
+ 	["OnLeave"] = function(rowFrame, cellFrame, data, cols, row, realrow, column, scrollingTable, ...) end,
- 			});
+ });
  <</code>>
- 2. Call SetDisplayCols on it with new headers.
+ 2. Set new display cols
+ <<code lua>>
+ scrollTable:SetDisplayCols({
+ 	{
+ 		["name"] = "Item",
+ 		["width"] = 100,
+ 	},
+ 	{
+ 		["name"] = "No",
+ 		["width"] = 50,
+ 	},
+ });
+ <</code>>
+ 3. Set some same data
+ <<code lua>>
+ scrollTable:SetData({
+     { "Sachmo", 12 },
+     { "Josua", 8 },
+ });
+ <</code>>
- 3. Click the sort headers.
+ 4. Click the sort headers.
  **What is the expected output? What do you see instead?**
+
  Continue using the default events.

  **What version of the product are you using?**
+
  r139

  **Please provide any additional information below.**
+
- I have fixed the issue for me for the time being by defining an empty OnClick event.
+ I have fixed the issue for me for the time being by defining an empty custom OnClick event.
Zerotorescue Jan 18, 2011 at 21:52 UTC Create

You must login to post a comment. Don't have an account? Register to get one!

Facts

Last updated
Jan 18, 2011
Reported
Jan 18, 2011
Status
New - Issue has not had initial review yet.
Type
Defect - A shortcoming, fault, or imperfection
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees