I am unable to get a binary action to work with a 'state' field in an associated model. The relationship of the main model to the associated model is "hasOne." The db 'state' field I am trying to toggle is tinyint(1).
I added an identically configured 'state' field to my main model and tested the binary action with it, just to make sure I was doing everything correctly, and it worked fine. But it won't work with the associated model. Could it have something to do with the relationship? Any other ideas?
Many thanks -
-Brian
I added an identically configured 'state' field to my main model and tested the binary action with it, just to make sure I was doing everything correctly, and it worked fine. But it won't work with the associated model. Could it have something to do with the relationship? Any other ideas?
Many thanks -
-Brian
Hi Brian,
Did you include the model id ? like this:
Regards,
Max
Did you include the model id ? like this:
Model2.state
Regards,
Max
Yes, I did. However, since I was unable to solve the problem, I restructured my databases, so Binary with the associated model is no longer required. Thanks, though!
-Brian
-Brian
In case I ever want to do this in the future, I decided to try again with a test listing. It still doesn't work. Here are the images from my set-up.
model1: [attachment=0]model1.PNG[/attachment]
model2:[attachment=1]model2.PNG[/attachment]
The frontlist column settings:[attachment=2]frontlist1.PNG[/attachment]
And the frontlist binary settings:[attachment=3]frontlist2.PNG[/attachment]
The result:[attachment=4]result.PNG[/attachment]
Clicking on the Model 2 State button never results in the state changing.
Thanks -
-Brian
model1: [attachment=0]model1.PNG[/attachment]
model2:[attachment=1]model2.PNG[/attachment]
The frontlist column settings:[attachment=2]frontlist1.PNG[/attachment]
And the frontlist binary settings:[attachment=3]frontlist2.PNG[/attachment]
The result:[attachment=4]result.PNG[/attachment]
Clicking on the Model 2 State button never results in the state changing.
Thanks -
-Brian
Your setup looks correct to me, assuming the foreign key is correct (room_id), what happens when you click the "Model 2 state" icons ?
You may also enable the debugging in your list config to check the generated sql data.
Regards,
Max
You may also enable the debugging in your list config to check the generated sql data.
Regards,
Max
This topic is locked and no more replies can be posted.