opalepatrick Posted February 1, 2022 Share Posted February 1, 2022 Trying to get an id attribute to the row $table->row([$club->title, $club->id],['cid' => $club->id, $club->title, $club->club_status->title]); The attribute is cid in the options part of this row - the row is not getting tagged with the cid - Am I missing something? This is being used in a Process module. Everything else in both parts works fine. Link to comment Share on other sites More sharing options...
gebeer Posted February 1, 2022 Share Posted February 1, 2022 When you build a table row, the attributes for that row need to go in an options array. $data = [$club->title, $club->id]; $options = array(); $options['class'] = "class1 class2"; // class (string): specify one or more class names to apply to the <tr> $options['attr'] = array('cid' => $club->id); // attrs (array): array of attr => value for attributes to add to the <tr> $table->row($data, $options); Hope this helps. Link to comment Share on other sites More sharing options...
opalepatrick Posted February 1, 2022 Author Share Posted February 1, 2022 Thank you @gebeer I stared at that for so long and just changed it to the shorthand version without thinking when looking at other code samples! Once again Thanks. Link to comment Share on other sites More sharing options...
opalepatrick Posted February 1, 2022 Author Share Posted February 1, 2022 (edited) Strange - still not attaching the cid to the row. It is in a loop and I know it works as it is also in the data? *I spotted that in the options code it should read plural attrs Edited February 1, 2022 by opalepatrick Resolved. I think 1 Link to comment Share on other sites More sharing options...
kongondo Posted February 1, 2022 Share Posted February 1, 2022 1 hour ago, opalepatrick said: *I spotted that in the options code it should read plural attrs Yes. Works for me. Good catch ?. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now