⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Show a grid of sub items when you are editing a head record



Bart

Bart
  • profile picture
  • Member

Posted 27 September 2017 - 01:03 AM

I am new to grocery crud and I never saw a clear example of this.

 

You have a head record like Order and you have the sub items or children like OrderLines.

 

If I am viewing a particular head record (order) I would like to see a grid of all the children Order Lines of that particular Order.
 

In the community esion I was able to do this by using a iframe for the children

Because the URL decides about the state.

HOWEVER in the entreprise version the edit mode is a popup window.

 

What is a clean way to solve this ?

 

This is commonly used in applications I think.

 

Regards Bart

 

 


larasmith

larasmith
  • profile picture
  • Member

Posted 27 September 2017 - 03:33 AM

It seems you are needing dependent drop-downs too?

 

Could you send sample screenshot?

 

Why use iframe for the children?


darkstalker

darkstalker
  • profile picture
  • Member

Posted 28 September 2017 - 07:09 AM

I think i understand what he means and i think that is a very important feature needed. Example: table 1 for customer's orders. You insert data about customer, order date and so on......
You also use a relation n to n to fill in what the customer ordered. (Example: food, drink....)
With relation n to n you can't edit other infos like quantity of food, quantity of drink etc etc
So he want the possibilty to insert that data and also see them and edit them when you edit the order.
I think it's a complex scenario but it should be addressed soon or later because the order - order's details is a very common situation.
Maybe with the new kaizen concept ? ;)

Bart

Bart
  • profile picture
  • Member

Posted 29 September 2017 - 11:42 AM

I think i understand what he means and i think that is a very important feature needed. Example: table 1 for customer's orders. You insert data about customer, order date and so on......
You also use a relation n to n to fill in what the customer ordered. (Example: food, drink....)
With relation n to n you can't edit other infos like quantity of food, quantity of drink etc etc
So he want the possibilty to insert that data and also see them and edit them when you edit the order.
I think it's a complex scenario but it should be addressed soon or later because the order - order's details is a very common situation.
Maybe with the new kaizen concept ? ;)

Yes indeed that is what I want.
I found out the setRelationNToN looked promising but it only gives you tags on one field but I need to be able to edit the children records too.


larasmith

larasmith
  • profile picture
  • Member

Posted 30 September 2017 - 00:20 AM

I would suggest you create a separate editing module for the children records.

 

That would be possible and easier to do.

 

Happy GCing!  :) 


Bart

Bart
  • profile picture
  • Member

Posted 06 October 2017 - 09:24 AM

I would suggest you create a separate editing module for the children records.

 

That would be possible and easier to do.

 

Happy GCing!  :) 

I checked the code ENTERPRISE version.

It starts from MainState object it generates html and a lot of javascript.

After that it continues in javascript It uses Handlebars but I can not find the file Handlebars.js

It looks like it is all done in grocery-crud-v2.3.3....js

If it is so easy can you give me some hints.
It looks like I have to use more javascript than PHP and know all the javascript libraries that are used.


larasmith

larasmith
  • profile picture
  • Member

Posted 10 October 2017 - 00:36 AM

I checked the code ENTERPRISE version.

It starts from MainState object it generates html and a lot of javascript.

After that it continues in javascript It uses Handlebars but I can not find the file Handlebars.js

It looks like it is all done in grocery-crud-v2.3.3....js

If it is so easy can you give me some hints.
It looks like I have to use more javascript than PHP and know all the javascript libraries that are used.

 

What I mean is instead of trying to develop an editable children as sub-items

why not create a separate module to edit those children?

 

It is just my suggestion though.


Remco

Remco
  • profile picture
  • Member

Posted 24 July 2018 - 15:25 PM

What I mean is instead of trying to develop an editable children as sub-items

why not create a separate module to edit those children?

 

 

 

Hi Iarasmith,

 

Could you help me along a bit please I am strugling with the same problem ... I need an Ordering system where each Order has many Orderlines

 

thx in advance


larasmith

larasmith
  • profile picture
  • Member

Posted 24 July 2018 - 23:53 PM

Hi Iarasmith,

 

Could you help me along a bit please I am strugling with the same problem ... I need an Ordering system where each Order has many Orderlines

 

thx in advance

 

Could you show the structure of your database?  :)


Remco

Remco
  • profile picture
  • Member

Posted 27 July 2018 - 12:44 PM

Could you show the structure of your database?  :)

Hi Iarasmith,

 

Thank you!

 

In its simplest form it looks like this where the header table is Orders:

 

CREATE TABLE IF NOT EXISTS Orders (
    OrderID INT NOT NULL AUTO_INCREMENT,
    OrderDate DATE NOT NULL,
    RelationID varchar(50) CHARACTER SET utf8mb4 NOT NULL,
    OrderType varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderContactTypeEmployee varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderStatus varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderNotes LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL,
    PRIMARY KEY (OrderID,RelationID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;



CREATE TABLE IF NOT EXISTS OrderLines (
    OrderLineID INT NOT NULL AUTO_INCREMENT,
    OrderID varchar(50) CHARACTER SET utf8mb4 NOT NULL,
    OrderNotes LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL,
    PRIMARY KEY (OrderLineID,OrderID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

 

Thanks for having a look!


larasmith

larasmith
  • profile picture
  • Member

Posted 30 July 2018 - 04:31 AM

Hi Iarasmith,

 

Thank you!

 

In its simplest form it looks like this where the header table is Orders:

 

CREATE TABLE IF NOT EXISTS Orders (
    OrderID INT NOT NULL AUTO_INCREMENT,
    OrderDate DATE NOT NULL,
    RelationID varchar(50) CHARACTER SET utf8mb4 NOT NULL,
    OrderType varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderContactTypeEmployee varchar(50) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderStatus varchar(10) CHARACTER SET utf8mb4 DEFAULT NULL,
    OrderNotes LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL,
    PRIMARY KEY (OrderID,RelationID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;



CREATE TABLE IF NOT EXISTS OrderLines (
    OrderLineID INT NOT NULL AUTO_INCREMENT,
    OrderID varchar(50) CHARACTER SET utf8mb4 NOT NULL,
    OrderNotes LONGTEXT CHARACTER SET utf8mb4 DEFAULT NULL,
    PRIMARY KEY (OrderLineID,OrderID)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;

 

Thanks for having a look!

 

 

I see I would suggest that you create 2 GCRUD for each of the tables so you can edit on both.


Remco

Remco
  • profile picture
  • Member

Posted 31 July 2018 - 21:15 PM

I see I would suggest that you create 2 GCRUD for each of the tables so you can edit on both.

Oke ... thank you