Allow user to choose 'skin' for datagrid

Talk about implementation of CSS styles, skins etc.

Moderator: alexandrleonenko

poweruser
Newbie
Newbie
Posts: 2
Joined: Oct 28th, '10, 15:46

Allow user to choose 'skin' for datagrid

Postby poweruser » Oct 29th, '10, 18:00

How do I allow my users to choose the 'skin' for their datagrid as per the example on the the demo page - which is not supported by the example code shown.

administrator
Site Admin
Site Admin
Posts: 6004
Joined: Jan 7th, '09, 23:18
Contact:

Re: Allow user to choose 'skin' for datagrid

Postby administrator » Oct 31st, '10, 10:55

Open html source of example page, look how it was done and simply copy the code

poweruser
Newbie
Newbie
Posts: 2
Joined: Oct 28th, '10, 15:46

Re: Allow user to choose 'skin' for datagrid

Postby poweruser » Oct 31st, '10, 15:18

'Live Demo' examples do not include the configuration code to implement the 'User skin choice' functionality. The HTML code clearly shows that the 'css' is based on the users choice, but how is the user offered the choice in the datagrid php script.

I presume from the datagrid class code that the contents of the 'css' directory are listed and selected by the user, but how is a drop down box instantiated and selections recognised and processed.

Also 'autocomplete' code from www.brandspankingnew.net does not seem to be embedded in datagrid.class.php as implied in the comments - or am I missing something.

I think your datagrid offering is by far and away the best, most capable, available, as a RICO framework user for 2 years I appreciated the custom options you provide - but please assume that the majority of posters have at least checked the FAQ's, examined the code examples and consulted the class code before posting.

John

administrator
Site Admin
Site Admin
Posts: 6004
Joined: Jan 7th, '09, 23:18
Contact:

Re: Allow user to choose 'skin' for datagrid

Postby administrator » Nov 1st, '10, 08:53

1. Add after $dgrid->Datasource()

$dgrid->navigationBar = "&nbsp;<label class='class_label'>Skin:</label>
<select class='".$css_class."_dg_select' onChange='document.location.href=\"sample_2_1_demo.php?skin=\"+this.value;'>
<option ".(($css_class == "x-blue") ? "selected" : "")." value='x-blue'>x-blue</option>
<option ".(($css_class == "x-gray") ? "selected" : "")." value='x-gray'>x-gray</option>
<option ".(($css_class == "x-green") ? "selected" : "")." value='x-green'>x-green</option>
<option ".(($css_class == "default") ? "selected" : "")." value='default'>default</option>
<option ".(($css_class == "blue") ? "selected" : "")." value='blue'>blue</option>
<option ".(($css_class == "gray") ? "selected" : "")." value='gray'>gray</option>
<option ".(($css_class == "pink") ? "selected" : "")." value='pink'>pink</option>
<option ".(($css_class == "green") ? "selected" : "")." value='green'>green</option>
</select>&nbsp;&nbsp;";

2. At the top of your page :
$css_class = (isset($_REQUEST['skin']) && $_REQUEST['skin'] != "") ? $_REQUEST['skin'] : "x-blue";

3. In css style definition:
$dgrid->SetCssClass($css_class);

ethanthomas82
Junior
Junior
Posts: 22
Joined: Jan 22nd, '12, 23:35

Re: Allow user to choose 'skin' for datagrid

Postby ethanthomas82 » Jan 27th, '12, 06:40

How can I make the below line more generic so that it doesn't refer to sample_2_1?

<select class='".$css_class."_dg_select' onChange='document.location.href=\"sample_2_1_demo.php?skin=\"+this.value;'>

ethanthomas82
Junior
Junior
Posts: 22
Joined: Jan 22nd, '12, 23:35

Re: Allow user to choose 'skin' for datagrid

Postby ethanthomas82 » Jan 28th, '12, 03:30

I got it working. Thanks anyway!


Return to “Settings: CSS styles”