如何将所有行值放入单元格
rows = db().select(i.INV_ITEMCODE, n.INV_NAME, orderby=i.INV_ITEMCODE, join=n.on(i.POS_TASKCODE == n.POS_TASKCODE))
for r in rows:
code = str(r.db_i_item.INV_ITEMCODE)
desc = str(r.db_i_name.INV_NAME)
row = [dict(rows=rows)]
cell = [code, desc]
row = [dict(cell=cell, id=str(+1))]
records = []
total = []
result = None
result = dict(records=str(total), total='1', row=row , page='1') #records should get the total cell
return result
结果仅返回一个单元格值dict:{'records':'[]','total':'1','page':'1','row':[{'cell':['LUBS001', '有。全合成 1L'], 'id': '1'}]}
但 ROWS 有以下查询:
Rows: db_i_item.INV_ITEMCODE,db_i_name.INV_NAME
LUBS001,Hav. Fully Synthetic 1L
LUBS002,Hav. Formula 1L
LUBS003,Hav. SF 1L
LUBS004,Hav. Plus 2T 200ML
LUBS005,Havoline Plus 2T 1L
LUBS006,Havoline Super 4T 1L
LUBS007,Havoline EZY 4T 1L
LUBS008,Delo Sports 1L
LUBS009,Delo Gold Multigrade 1L
LUBS010,Delo Gold Monograde 1L
LUBS011,Delo Silver 1L
LUBS012,Super Diesel 1L
LUBS013,Brake Fluid 250ML
LUBS014,Brake Fluid 500ML
LUBS015,Brake Fluid 1L
LUBS016,Texamatic ATF 1L
LUBS020,Coolant
LUBS21,Delo
PET001,DIESEL
PET002,SILVER
PET003,GOLD
PET004,REGULAR
PET005,KEROSENE