Jump to content

Recommended Posts

Posted
Hello, 

i need a dynamic table with fields inside a page 

the y and x axis of the table has to get his values from two separate pagefields. 

for example 

                                pagefield-B-val2 | pagefield-B-val2 | pagefield-B-val3

pageField-A-val1|         inputfield    | inputfield             | inputfield     

pageField-A-val2|         inputfield    | inputfield             | inputfield    

pageField-A-val3|         inputfield    | inputfield             | inputfield    

pageField-A-val4|         inputfield    | inputfield             | inputfield    

each time i select a new value from the pagefield(s) the table must by automaticaly increase with the new value. 

is this possible?? 

i have try with Ryans FieldtypeEvents module but i fail to save the inputfield value in DB 

I would appreciate any ideas. 

thanks.

Posted
  1. Could you show us the code you tried with FieldtypeEvents?
  2. Do you also want the first column and header rows (pageField-A-valx and pageField-B-valx) to be visible in the inputfield or just the calculated values?

Maybe first solve this (if you can :-)) outside the Fieldtype then try and implement it in FieldtypeEvents. What sort of calculations are you carrying out by the way, i.e. y * x?

Posted

hi, kongondo, thanks for your response

i dont want to calculate the values, just to save the inputfield values so i can search them, pe find("pagefield-A=something, $pagefield-B=something) , return $value, 

i am not in my pc right now, i wil post my code later today

Posted (edited)

OK, then your table illustration is a bit confusing. Do you mean you want to store the values of both pagefield-A and pagefield-B in one inputfield? E.g. store x,y in the inputfield? Or do you want to store them separately e.g. 

pages_id 	| x (pageField-A values)| y (pageField-B values)
5022		|		4    	|		8
5038		|		7	|		10
5045		|		15	|		12

If that is the case, it might actually be less work to start from Soma's FieldtypeDimension - https://processwire.com/talk/topic/4081-fieldtypedimension/. I have a feeling though that I am not getting you correctly and I might be mixing up what you want to be visible in the Inputfield vs the structure of the database table for this Fieldtype :-)

 
 
Edited by kongondo
Posted

pagefieldA contains the Y axis names of the table and the pagefieldB the X axis Names of the table, and i want to save new values inside the table, here is an example.

i want to save prices for one car with spesific color and Engine, so i have two pagefields, one for colors and one for engines

PageField A    PageField B    

red                   1000cc

green              1200cc

black               1400cc

                        1600cc
                        1800cc

so i get a table 

              1000cc   1200cc   1400cc   1600cc   1800cc

red          400$       800$        1200$       etc..          etc..

green      250$      420$        etc..          etc..          etc..

black         etc..       etc..           etc..         etc..          etc..

Posted

Hi...just a quick one to let you know that I have this working...rows and columns grow with each new row and column pages or shrink when these are deleted/trashed/hidden/unpublished.

I need to do a couple more tests and cleanup the code (remove hard-coded stuff, rename the db table columns to something more generic, e.g. matrix_row and matrix_column, etc) . I also want to make the Fieldtype more configurable - e.g. ability to use a PW selector to find pages to populate rows and column headers (x and y axes).

However, not sure if the Fieldtype duplicates what is already available in PageTable? Anyway, here's some screens..

matrix (InputfieldMatrix)

post-894-0-19898500-1418526162_thumb.png

db table (FieldtypeMatrix)

post-894-0-81007400-1418526295_thumb.png

  • Like 7

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...