I'm using the vuetify pagination and the code looks something like this:
<v-pagination
v-model="page"
:length="n"
total-visible="7"
></v-pagination>
Where n is greater than 7, if you're on the first few pages, it'll show the first few pages and the last few pages. I don't want it to show the last few pages.
Also, say you're on page 14 of n, it'll show the first page, pages 13-15, and the nth page. I want it to show +/- some range of pages around page 14 (range of 2 would mean 12-16 are visible). At a min, I'd want to show just the next and previous buttons.
What it does:
< [ 1 ] [ 2 ] [ 3 ] ... [ n -2 ] [ n-1 ] [ n ] >
< [ 1 ] ... [ k-1 ] [ k ] [ k+1 ] ... [ n ] >
What I want:
< [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] ... >
< ... [ k-1 ] [ k ] [ k+1 ] ... >
~OR~
< >
I added the following to the component and it "worked":
<style scoped>
/deep/ .v-pagination__item{
display: none;
}
/deep/ .v-pagination__more{
display: none;
}
</style>
...where "worked" means only the next/previous arrows are visible.
Related
I have a dropdown which shows text as moredetails with a keyboard-down-arrow, on clicking it expands and i can see the required fields. What i am trying to achieve is once on clicking the button when the secondary field expands i want to change the text to 'less details', i am able to achieve till like on expansion the keyboard downarrow mark becomes keyboard up arrow mark.
this is my code
Html.span
[ Attributes.class "details" ]
[ Html.a
[ Attributes.href "#", Events.onClick (ExpandDetails tx.id)]
[ Html.text "More detail"
, Html.i
[ Attributes.class "material-icons" ]
[ if expanded then
Html.text "keyboard_arrow_up"
else
Html.text "keyboard_arrow_down"
]
]
]
i am able to make it till if expands show downarrow but along with it i need text to change from more details to less details and on clicking less details it should be back to more details.
If I'm understanding correctly, you could define both the button and text in a let expression before the dropdown code. Something like:
let
( dropdownButton, dropdownText ) =
if expanded then
( "keyboard_arrow_up", "Less details" )
else
( "keyboard_arrow_down", "More details" )
in
Html.span [ Attributes.class "details" ]
[ Html.a
[ Attributes.href "#"
, Events.onClick (ExpandDetails tx.id)
]
[ Html.text dropdownText
, Html.i [ Attributes.class "material-icons" ]
[ Html.text dropdownButton ]
]
]
Here's an alternative.
Move the link into a function that takes the Strings as arguments.
viewDetails : Tx -> Bool -> Html Msg
viewDetails tx expanded =
let
lessOrMoreLink =
if expanded then
viewExpandLink "Less" "keyboard_arrow_up"
else
viewExpandLink "More" "keyboard_arrow_down"
in
Html.span
[ Attributes.class "details" ]
[ lessOrMoreLink tx.id ]
viewExpandLink : String -> String -> Int -> Html Msg
viewExpandLink txt arrow id =
Html.a
[ Attributes.href "#"
, Events.onClick (ExpandDetails id)
]
[ Html.text (txt ++ " details")
, Html.i
[ Attributes.class "material-icons" ]
[ Html.text arrow ]
]
I stumbled on this and just wanted to make sure this isn't a glitch in Rebol's design. I have the following code which seems to successfully catch all program errors in the VID environment.
view layout [
across
label "Rebol Command:"
f: field [
do f/text
focus f
] return
button "Error 1" [
print this-is-an-error-1
]
button "Error 2" [
print this-is-error-2
]
time-sensor: sensor 0x0 rate 1000
feel [
engage: func [face action event] [
if action = 'time [
time-sensor/rate: none
show face
if error? err: try [
do-events
true ; to make the try happy
][
the-error: disarm :err
? the-error
; reset sensor to fire again
time-sensor/rate: 1000
show face
focus f
]
]
]
]
do [
focus f
]
]
This isn't a glitch—do-events is indeed the dispatcher that will run until an error occurs. I'd suggest decoupling the error handler from the layout model itself though:
view/new layout [
across
label "Rebol Command:"
f: field [
do f/text
focus f
] return
button "Error 1" [
print this-is-an-error-1
]
button "Error 2" [
print this-is-error-2
]
do [
focus f
]
]
forever [
either error? err: try [
do-events
][
the-error: disarm :err
? the-error
focus f
][
break
]
]
I know how to adjust the size of the border within r3gui:
view [
b: box 800x400 red options [
box-model: 'frame border-size: [4x2 2x4]
]
]
But how can I make an ibevel border/edge effect known from R2/View with r3gui?
Rebol2/View example:
view [
box 800x400 red edge [size: 4x4 effect: 'ibevel color: gray]
]
The 'ibevel effect is not directly supported in Rebol3. But you should be able to achieve it using R3-GUI widget style customization using draw dialect:
stylize [
my-box: box [
facets: [
border-colors: [
65.65.65 191.191.191
]
]
draw: [
line-width 1 fixed
pen border-colors/1
fill-pen border-colors/1;
polygon border-box/top-left border-box/top-right (as-pair border-box/top-right/x - border-size/2/1 border-box/top-right/y + border-size/1/2) (border-box/top-left + border-size/1)
(as-pair border-box/bottom-left/x + border-size/1/1 border-box/bottom-left/y - border-size/2/2) border-box/bottom-left
pen border-colors/2 ;
fill-pen border-colors/2
polygon border-box/bottom-right border-box/top-right
(as-pair border-box/top-right/x - border-size/2/1 border-box/top-right/y + border-size/1/2) (as-pair border-box/bottom-right/x - border-size/2/1 border-box/bottom-right/y - border-size/2/2)
(as-pair border-box/bottom-left/x + border-size/1/1 border-box/bottom-left/y - border-size/2/2) border-box/bottom-left
]
]
]
view [
my-box 300x300 red options [
border-size: [4x2 2x4]
]
my-box 300x300 red options [
border-size: [4x8 12x24]
border-colors: [0.0.255 0.255.0]
]
]
In the MSDN Library or the Technet website, Microsoft tend to use a pseudo syntax in explaining how to use T-SQL statements with all available options. Here is a sample taking from the Technet page on UPDATE STATISTICS :
UPDATE STATISTICS table_or_indexed_view_name
[
{
{ index_or_statistics__name }
| ( { index_or_statistics_name } [ ,...n ] )
}
]
[ WITH
[
FULLSCAN
| SAMPLE number { PERCENT | ROWS }
| RESAMPLE
| <update_stats_stream_option> [ ,...n ]
]
[ [ , ] [ ALL | COLUMNS | INDEX ]
[ [ , ] NORECOMPUTE ]
] ;
<update_stats_stream_option> ::=
[ STATS_STREAM = stats_stream ]
[ ROWCOUNT = numeric_constant ]
[ PAGECOUNT = numeric_contant ]
How to properly read such description and quickly figure out what is required and what is optional and a clean way to write your query?
You should refer to this Transact-SQL Syntax Conventions
The first table in that article explains pretty much everything.
In your example we can see the following:
UPDATE STATISTICS table_or_indexed_view_name
UPDATE STATISTICS is the keyword used
table_or_indexed_view_name is the name of the table or the view to update statistics for
[
{
{ index_or_statistics__name }
| ( { index_or_statistics_name } [ ,...n ] )
}
]
This is optional [], but if supplied, you have to put a statistic name {index_or_statistics__name}, or | a list of statistic names separated by commas { index_or_statistics_name } [ ,...n ]
[ WITH
[
FULLSCAN
| SAMPLE number { PERCENT | ROWS }
| RESAMPLE
| <update_stats_stream_option> [ ,...n ]
]
[ [ , ] [ ALL | COLUMNS | INDEX ]
[ [ , ] NORECOMPUTE ]
] ;
This is optional too []. If used then you must begin with a WITH and you have 4 options that you must choose from.
Your options are
FULLSCAN
SAMPLE number { PERCENT | ROWS }, where you have to define the number and you must choose from PERCENT or | ROWS
RESAMPLE
` [ ,...n ]' which is a list separated by commas
Then you have to choose either ALL, COLUMNS or INDEX and preside that with a comma if you have used the WITH.
Lastly you have another option to use the NORECOMPUTE and put a comma before it if you have used any other option before it.
<update_stats_stream_option> ::=
[ STATS_STREAM = stats_stream ]
[ ROWCOUNT = numeric_constant ]
[ PAGECOUNT = numeric_contant ]
These are the list of predefined options you may use where <update_stats_stream_option> is used before (in 4).
Any thing between Square Brackets [...] are Optional
Any thing seperated by the pipe | symbol is a one or the other option.
In your above example, you could read it as
UPDATE STATISTICS table_or_indexed_view_name
[ optionally specify an index as well]
[ optionally specify options using **WITH**
If you use WITH then you can follow it with one of the following keywords
FULLSCAN
OR SAMPLE number { PERCENT | ROWS }
OR RESAMPLE
].. and so on
I'm trying to add a field to a layout after it has been viewed
view/no-wait m: [field "hello"]
insert tail m 'field
insert tail m "hello"
update-face m
** Script error: update-face does not allow block! for its face argument
I want to update the whole layout, not just the field or some part of it. If I try to use
view m, it opens a new window. Do I just have to un-view it and then view again?
You can use the LAYOUT function in R3-GUI as well. See the example below:
view/no-wait m: layout [field "hello"]
;We need to get the BACKDROP container which is first sub-face in the WINDOW face
m: first faces? m
append-content m [
field "world"
]
do-events
Ofcourse there are also other ways how to handle layout content dynamically.
Try this example from Richard
REBOL [
Title: "Layouts example #20"
Author: "Richard Smolak"
Version: "$Id: layouts-20.r3 852 2010-10-07 13:28:26Z cyphre $"
]
stylize [
tbox: hpanel [
about: "Simple rectangular box."
facets: [
init-hint: 200x200
min-hint: 0x0
max-hint: guie/max-pair
break-after: 1
]
options: [
init-hint: [pair!]
]
actors: [
on-make: [
append face/options [
content: [
button "hello" on-action [print "hello"]
button "world" on-action [print "hello"]
]
]
do-actor/style face 'on-make none 'hpanel
]
]
draw: [
pen red
fill-pen blue
box 0x0 (viewport-box/bottom-right - 1)
]
]
]
view [
test: tbox
button "clear"
on-action [
clear-content test
]
button "set"
on-action [
set-content test [
button "test"
field "the best"
]
]
button "insert"
on-action [
insert-content test bind/set probe reduce [to-set-word copy/part random "abcdefgh" 2 'button join "button #" 1 + length? test/gob] 'system
]
button "append"
on-action [
append-content test reduce ['button join "button #" 1 + length? test/gob]
]
button "remove 2 faces at pos 3"
on-action [
remove-content/pos/part test 3 2
]
]
so the words you're looking for are append-content and insert-content which take a face and a block as parameters where the block contains the definition of another face.
I don't know view yet, but I have a hint. The first line sets "m" to the block [field "hello"]. Check to see what "update-face" expects...